0

I have a progam using hibernate @Version annotation to do optimistic locking.

I want to update a row on the database without doing it via hibernate.

Is it possible to simply increase the value in the column in my DB-Update script and will hibernate then follow the right behavior (throw an exception since the version has changed)?

1 Answer 1

2

Yes, it should be possible to increment the version number externally and hibernate will throw an exception if you try and save with an out of date version number.

If you are not seeing that behaviour, you should look into the "hibernate.jdbc.batch_versioned_data" property in your hibernate configuration.

See Hibernate saves stale data with hibernate.jdbc.batch_versioned_data for more info.

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

Comments

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.