-->
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: Saving tranisent object generates bunch of updates
PostPosted: Thu Feb 14, 2008 6:45 pm 
Newbie

Joined: Thu Jan 31, 2008 1:48 pm
Posts: 11
When I save an instance of transient object, hibernate generates the insert sql which make sense but when the transaction is committed it generates bunch of update statements. I looked at associated objects that are defined in the hbm file of this class but references to those objects are null, so wondering how how come it generates so many update statements. If anybody has experienced this and can share how to debug and narrow down this issue.

Thanks in advance for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 15, 2008 7:33 am 
Beginner
Beginner

Joined: Fri Oct 06, 2006 7:11 am
Posts: 32
Hi,

I have the same trouble. I have looked into this and as I understand it has to do with the cascade values set in your hbm.xml files. When you set the value to 'all', Hibernate will save, update and delete all instances. But it seems that when you save a parent object, this cascades to updates to any children even though there are no changes made to the children.

This is causing problems for me because I have triggers on my database that record audit data of all insert, updates and deletes and when my parent object is saved the update trigger fires on all the children even though no updates were made.

I think the only way round this is to explicitly save your objects and set your cascades to 'none'.

I'm trying this now but can see its going to be problematic.

Is anyone else having this trouble ?

Am I right in my assumptions above?

Is there a way to stop my children getting updated when the parent is saved ?

Plese help the kids out !!


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.