how to configure hibernate not to update @Version on each access to entity
Posted
by
radai
on Stack Overflow
See other posts from Stack Overflow
or by radai
Published on 2011-03-16T07:56:07Z
Indexed on
2011/03/16
8:10 UTC
Read the original article
Hit count: 198
i have a simple query that returns an entity, and when i look at hibernate SQL output i see that when i execute this query hibernate updates the @Version field (on each consecutive read the @version field is updated). i dont modify anything in the entity i fetch, and i dont pass is as an argument to either persist or merge. this effectively means every read i make turns into a read+write. i've tried setting the lock mode t oboth NONE (jpa 2) and READ (jpa 1) to no avail.
is there any way to achieve this? if so, is there any way to set this as the default behavior in persistence.xml in some way ?
im using jpa2 over hibernate 3.6
© Stack Overflow or respective owner