-->
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: Insert triggers unneeded updates
PostPosted: Mon May 05, 2008 6:50 pm 
Newbie

Joined: Mon May 05, 2008 6:43 pm
Posts: 1
I'm fairly new to Hibernate. I saved a new entity, lets say Foo, and I saw the SQL fly across my console with the corresponding insert statement. Cool.. Good...

When the service call is finished, however, hibernate proceeds to update two other tables that are referenced as foreign keys in my Foo entity. I don't feel this is valid because I didn't not make any changes to the other two entities, just set their primary key in my Foo entity.

The downside in my mind is on every update and insert, hibernate will trigger a whole slew of updates that essentially do nothing.

How can I disable this feature? Could it be due to the fact I am using optimistic offline locking with the @Version annotation?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 5:01 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Need to see your mappings to know for sure, but I bet you have some <one-to-many> associations that are not inverse. This is a recipe for what you're seeing. I just explained this in another post:

http://forum.hibernate.org/viewtopic.php?t=986558

But this is just a guess since you have not provided the information asked for when you posted...

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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.