-->
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.  [ 4 posts ] 
Author Message
 Post subject: Use of cascade=all from many-to-one side of the relationship
PostPosted: Fri Feb 16, 2007 3:50 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: Fri Feb 16, 2007 4:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to read up about what cascading in ORM mappings actually means...plus ask usage questions in the user forum, not the tools forum ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Use of cascade=all from many-to-one side of the relationship
PostPosted: Fri Feb 16, 2007 4:51 am 
Newbie

Joined: Fri Jan 26, 2007 10:13 pm
Posts: 9
My apologies for posting to the wrong forum.

As for reading about "cascading in ORM mappings", I would be delighted if you can suggest some books, articles etc. Is it different from the general relational database paradigm?

Hitesh


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 16, 2007 4:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Docs: Hibernate reference documentation.
Book: Java persistence with Hibernate
Training: Hibernate Essentials and Hibernate Advanced

_________________
Max
Don't forget to rate


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