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.  [ 3 posts ] 
Author Message
 Post subject: One-to-one...I'm losing it...
PostPosted: Fri Jul 15, 2005 12:37 pm 
Beginner
Beginner

Joined: Fri Jul 15, 2005 12:26 pm
Posts: 37
Every guy has a house. Every car has a house. How oh how do I map a one-to-one relationship between two foreign keys? I'm losing it.

Image

Guy.hbm.xml

<property name="houseId" column="HOUSE_ID" type="java.lang.Long" insert="false" update="false"/>

<one-to-one name="car" class="Car" property-ref="houseId"/>



Car.hbm.xml

<property name="houseId" column="HOUSE_ID" type="java.lang.Long" insert="false" update="false"/>

<one-to-one name="guy" class="Guy" property-ref="houseId"/>



Still tries to join to one or the other primary keys...Am I crazy to think you should be able to join on two not-that-arbitray fields?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 12:44 pm 
Beginner
Beginner

Joined: Fri Jul 15, 2005 12:26 pm
Posts: 37
This sucker is a dup...can't delete it...Please post to the other thread...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 12:46 pm 
Senior
Senior

Joined: Tue Jan 11, 2005 5:03 pm
Posts: 137
Location: Montreal, Quebec
No you are not crasy. yet.

Have you tried the foreign-key attribute?

http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-declaration-onetoone

Etienne.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.