-->
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.  [ 1 post ] 
Author Message
 Post subject: different behavior for OPTIMISTIC_FORCE_INCREMENT 4.2 vs 3.6
PostPosted: Tue Jul 16, 2013 2:17 pm 
Newbie

Joined: Tue Jul 16, 2013 1:55 pm
Posts: 1
Hello,

I am in the process of migrating from Hibernate 3.6.10 to 4.2.3.

I notice a behavior difference between these two versions if it comes to the usage of the OPTIMISTIC_FORCE_INCREMENT lock on an entity.

Let's say that I have an existing entity with a version=0. If I then do the following:

1. load the entity through the EntityManager (version=0)
2. Apply the OPTIMISTIC_FORCE_INCREMENT lock on the entity
3. Modify the entity through a setter of an attribute
4. Flush the entity manager. This results in a version increment => version=1
5. Commit the transaction. For 3.6.10, the version is not incremented (version=1). For version 4.2.3 the version is incremented (version=2)

Since I am using DTOs to communicate objects back towards the client, this 4.2.3 behavior is a big issue to me. The conversion from entity to dto is done between the flush and commit (step 4 and 5). Using 4.2.3 this will result in having the client seeing an outdated version of the version, which is highly undesirable.

Is there anything I can do to tweak this behavior? If not, would this be a bug? (it definitely is not backwards compatible).

I would expect that if between a flush and commit no modifications occur on an entity, there would be no further database updates when doing the commit, or am I wrong on that?

All help is appreciated!
Thanks in advance,
Kind regards,
Franck de Bruijn


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.