These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Joined subclass& association mapping question
PostPosted: Fri Feb 08, 2008 4:35 pm 
Regular
Regular

Joined: Mon Mar 20, 2006 10:49 pm
Posts: 59
Hibernate version:1.2.1

I'm trying to map a legacy database containing 3 tables:

Person (PersonId, Name)
Employee (EmployeeId, PersonId, EmployeeNumber)
Assignment (EmployeeId, Department, StartDate, EndDate)

I'd like to map Employee as a joined-subclass of Person, but I can't get the one-to-many association from Employee to Assignment to work. When I try

<set name="Assignments">
<key column="EmployeeId"/>
<one-to-many class="Assignment"/>
</set>

NHibernate generates joins between Assignment.EmployeeId and Employee.PersonId, when what I want is a join between Assignment.EmployeeId and Employee.EmployeeId. I tried

<key column="EmployeeId" foreign-key="EmployeeId"/>

but it made no difference. Digging through the code, it appeared that the foreign-key attribute was being ignored completely.

Is there any way to do what I want?

_________________
Mike Abraham


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.