-->
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.  [ 5 posts ] 
Author Message
 Post subject: one-to-one&composite-id help
PostPosted: Wed Jan 26, 2005 11:08 pm 
Newbie

Joined: Tue Jan 18, 2005 1:07 am
Posts: 5
hi gays
how I can map two table with one-to-one relationship and composite-id?
eg. Table A and B have two column first_id and second_id and make them a composited primary id ,at the same time they have one-to-one association. How to write the map ?
3x


Top
 Profile  
 
 Post subject: Re: one-to-one&composite-id help
PostPosted: Thu Jan 27, 2005 11:18 pm 
Newbie

Joined: Tue Jan 18, 2005 1:07 am
Posts: 5
FlyInWind wrote:
hi guys
how I can map two table with one-to-one relationship and composite-id?
eg. Table A and B have two column first_id and second_id and make them a composited primary id ,at the same time they have one-to-one association. How to write the map ?
3x


no boby know it?? or Hibernate is never support this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 28, 2005 10:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
One-to-one joined by primary composite key is no problem. Have you tried using the same key class for both entities?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 30, 2005 11:21 pm 
Newbie

Joined: Tue Jan 18, 2005 1:07 am
Posts: 5
david wrote:
One-to-one joined by primary composite key is no problem. Have you tried using the same key class for both entities?

thinks david for your answer and you save me several day time. the problem is solved. thanks again


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 4:41 pm 
Newbie

Joined: Wed Feb 04, 2004 2:33 pm
Posts: 10
david wrote:
One-to-one joined by primary composite key is no problem. Have you tried using the same key class for both entities?


Does this work in Hibernate 2.1?

The docs for mapping a one-to-one from Person to Employee show the following:

<class name="person" table="PERSON">
<id name="id" column="PERSON_ID">
<generator class="foreign">
<param name="property">employee</param>
</generator>
</id>
...
<one-to-one name="employee"
class="Employee"
constrained="true"/>
</class>


Now, wouldn't my id be a <composite-id> instead of an <id> element, and if so, now I cant specify a generator of foreign??


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

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.