-->
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: Inserting into Parent and Child tables.
PostPosted: Mon Dec 05, 2005 4:28 am 
Newbie

Joined: Mon Dec 05, 2005 4:17 am
Posts: 3
Hi,
I have a Parent & Child tables, now i want to insert into both the table under same transaction. I have a many-to-one mapping in my child table's hbm file. I get Transaction object by saying
Code:
session.beginTransaction();
now if i insert into parent by saying
Code:
session.save(parent)
and then I say
Code:
session.save(child);

At the end i commit the transaction. In case of any exceptions I rollback the transaction. but without issuing a commit() after saving the parent I get an error because of referncial constraint I have in my DB. But if I commit after saving my parent I cant rollback if something goes wrong while inserting child.

Any help appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 3:47 pm 
Newbie

Joined: Sat Dec 03, 2005 8:41 am
Posts: 11
Can i pls take a look at ur mapping files. both the parent and the child.


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.