-->
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.  [ 3 posts ] 
Author Message
 Post subject: where does versioning happen?
PostPosted: Mon Jun 18, 2007 11:59 pm 
Newbie

Joined: Mon Jun 18, 2007 11:50 pm
Posts: 2
Hibernate version: 3.1

Hello,

I have what I hope is a simple question:

I have Hibernate Objects all with optimistic-lock="version" set (ie. using Hibernate's Automatic Versioning). If I read an object from the database, then modify that object, I would have expected its version to be automatically incremented immediately (I received this impression from the documentation). But it looks to me like the version is only incremented after a Flush.

Is this true? Are versions only incremented after the data has been flushed to the database?

thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 2:04 am 
Regular
Regular

Joined: Wed May 05, 2004 8:01 am
Posts: 53
The version is incremented when the actual sql update is being made. All updates usually happen at transaction commit (or earlier if the amount of changes is substantial). You can always force your updates with session flush.

Please rate if that helped.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 9:45 am 
Newbie

Joined: Mon Jun 18, 2007 11:50 pm
Posts: 2
Thanks for that, but I was actually hoping for a more complete answer. I have definitely seen the version incremented without the flush happening.

I may be using versioning for something it isn't meant to be used for. I was assuming if an object changed within the first level cache that the version would be incremented automatically.


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