Björn Zurmaar (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ecd86c...
) *commented* on HHH-14043 (
https://hibernate.atlassian.net/browse/HHH-14043?atlOrigin=eyJpIjoiZDkxZT...
)
Re: Two concurrent element shifts in a list damage database integrity. (
https://hibernate.atlassian.net/browse/HHH-14043?atlOrigin=eyJpIjoiZDkxZT...
)
Ok, as you wrote about the missing flushes I assumed you just added the flushes and only
copied JPAUnitTestCase.java. Sorry for the confusion. After some experiments I found out
that the flush() call does not change anything. The key here is that you modified Foo.java
and added:
@Version
Long version;
Thank you so much for showing me a way to fix the problem.
While the problem can be fixed this way I’m even more puzzled than before. Hibernate uses
optimistic locking by default. But in order to make this work you need a version field in
your entity. If this is correct:
* Is there any scenario where you can safely or actually should omit a version field?
* If this is a requirement for optimistic locking to work properly, why does hibernate not
complain about the missing field or automatically generate such a field on the DB level?
(
https://hibernate.atlassian.net/browse/HHH-14043#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14043#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100130- sha1:5f5b10c )