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: Automatic versioning
PostPosted: Fri Jul 22, 2005 2:18 pm 
Newbie

Joined: Thu Jul 14, 2005 3:45 pm
Posts: 2
Question on Automatic versioning -

During my testing it appears that Hibernate 3.05 updates the version number of any object that is 'saved' in a session. What is odd, is hibernate appears to update the version number of ALL objects in the session regardless of whether the object changed or not.

Test: Create object A -> save -> A version # = 1
Create object B -> save -> B version # = 1; A version # =2

note: Object A has no relationship with Object B

This test occures within a single DB session. If A is evicted from the session before the second save, its version # is not changed (the expected behavior).


Impact: If my application does a read of many object and saves a single object, my guess is the version # of ALL read objects will be updated (assuming all objects are in the save session).

Do I really have to manage the contents of the the session when saving changed objects (i.e. evict all read but not changed objects) to make sure the version number is not updated incorrectly?

thanks in advance.


Top
 Profile  
 
 Post subject: answer
PostPosted: Tue Jul 26, 2005 7:16 pm 
Newbie

Joined: Thu Jul 14, 2005 3:45 pm
Posts: 2
User error -- my object contained a UserType which had an error in the "equals" method. This appears to cause the dirty flag to be true and thus update the version number with each save/flush.


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.