0

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

1 Answer 1

1

There is a open Hibernate bug relating to version increments on read operations, which occurs under the following conditions:

  1. The entity has a component class or subclasses
  2. The component/subclasses must use an custom usertype
  3. The read operation is covered by transaction

It is marked critical so will hopefully be resolved in a near future release.

Sign up to request clarification or add additional context in comments.

1 Comment

According to the mentioned bug report, it's not a bug, but an erroneous custom usertype

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.