-->
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.  [ 2 posts ] 
Author Message
 Post subject: One-to-one mapping with shared primary keys
PostPosted: Mon Sep 29, 2008 6:15 am 
Newbie

Joined: Mon Sep 29, 2008 5:33 am
Posts: 1
Hi,

I have a Owner and House with One-to-one mapping on shared primary keys.

In Owner.hbm.xml i have defined mapping as follows.

<one-to-one name="house" class="House"/>.

and there is no mapping defined in House.

Now during save only Owner is getting saved and not the House.

I have the code as follows in the

Owner owner = new Owner();
House house = new House();
have set the values for both Owner and House and then,
owner.setHouse(house);

Finally i did a save as
session.save(owner);

Please help me in understanding how can i have a correct code to save both.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 7:27 am 
Regular
Regular

Joined: Tue Jul 29, 2008 3:30 am
Posts: 74
That would be the cascade mapping option.
More information can be found in the documentation:
http://www.hibernate.org/hib_docs/nhibe ... n-onetoone


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