-->
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' relationship
PostPosted: Thu Apr 19, 2007 5:18 am 
Newbie

Joined: Thu Apr 19, 2007 5:10 am
Posts: 5
Hello, :)

i have bidirectional 'one to one' relationship between two entities.
One one side i'm using many-to-one tag on the other side one-to-one.

Is there any other way, how to realize 'one to one' relationship?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 19, 2007 5:48 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Yes,
You can use <one-to-one> on both sides, with the special id generator.
In this case, no extra column is required for joining purposes.
Both tables share the same primary key value.

http://www.hibernate.org/hib_docs/v3/re ... tional-121

-----------------------------------------------------------
Rate the answer if you find it helpful


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 19, 2007 6:48 am 
Newbie

Joined: Thu Apr 19, 2007 5:10 am
Posts: 5
thx for the response,

so i assume, that it should be impossible to use <many-to-one> on both sides? i'm asking this - because the program (which i'm using to generate hibernate artefacts) generates on both sides <many-to-one>.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 19, 2007 7:54 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
>>> so i assume, that it should be impossible to use <many-to-one> on both sides?

No. It is possible with join tables.
http://www.hibernate.org/hib_docs/v3/re ... l-join-121

But, since your are using a code generator I am not sure if the solution helps you ?! ( very unusual mapping, extra join table )


-----------------------------------------------------------
Rate the answer if you find it helpful


Top
 Profile  
 
 Post subject: problem with one - to one !!
PostPosted: Sun Apr 22, 2007 3:19 pm 
Newbie

Joined: Sat Mar 03, 2007 3:14 am
Posts: 16
I have a class that have two one-to-one ralations, i need to load a class without the associations. How can i do that ??
I tried with lazy but does not work !!
Help please .. !!


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.