-->
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: Use of cascade=all from child to parent side
PostPosted: Fri Feb 16, 2007 3:53 am 
Newbie

Joined: Fri Jan 26, 2007 10:13 pm
Posts: 9
Hibernate version: 3.2.2 GA

Full stack trace of any exception that occurs:

Name and version of the database you are using: DB2 7.2.5

Hi All,

We have been using hibernate 3.x for the last few months in an application which has about 200 tables and lots of foreign key relationships. We have followed the practice of using cascade=all from the one-to-many side and cascade=none from the many-to-one side of every relationships. We have followed this assuming the standard database practices of avoiding cascades from the child side. Under these settings we were getting lots of TransientObjectException(s). I would say loads of it.
As suggested by the message thrown by the TransientObjectException
(object references an unsaved transient instance - save the transient instance before flushing:) we used lots immediate merge() to overcome this situation, yet we were still getting quite a few TransientObjectException to live with.
During the course of this turmoil one of us found out that all these problems are gone if we change cascade=none form the child side to cascade=all and use a single call to merge(). Ever since we have not got a single TransientObjectException.

I would like to know is this the right approach to use merge() in hibernate? Is there any side effects to this usage of merge on parent +cascade=all from child side

Any input on this will be highly appreciated esp from the hibernate core team.

Thanks,
Hitesh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 08, 2008 12:33 am 
Newbie

Joined: Thu Jan 03, 2008 7:21 pm
Posts: 15
This is quite a typical problem met by new Hibernate users like me. Can somebody give us some guidance? Thanks.


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.