[hibernate-issues] [JIRA] (HHH-14043) Two concurrent element shifts in a list damage database integrity.

Björn Zurmaar (JIRA) jira at hibernate.atlassian.net
Fri Jun 19 04:04:08 EDT 2020


Björn Zurmaar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ecd86c3dacd410c1f8c8da5 ) *commented* on HHH-14043 ( https://hibernate.atlassian.net/browse/HHH-14043?atlOrigin=eyJpIjoiZDkxZTdiNGU4NmIzNDUxOGE4ZGNmMDUzZTMzNGE2ZGUiLCJwIjoiaiJ9 )

Re: Two concurrent element shifts in a list damage database integrity. ( https://hibernate.atlassian.net/browse/HHH-14043?atlOrigin=eyJpIjoiZDkxZTdiNGU4NmIzNDUxOGE4ZGNmMDUzZTMzNGE2ZGUiLCJwIjoiaiJ9 )

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=eyJpIjoiZDkxZTdiNGU4NmIzNDUxOGE4ZGNmMDUzZTMzNGE2ZGUiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14043#add-comment?atlOrigin=eyJpIjoiZDkxZTdiNGU4NmIzNDUxOGE4ZGNmMDUzZTMzNGE2ZGUiLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100130- sha1:5f5b10c )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200619/8aa59b87/attachment.html 


More information about the hibernate-issues mailing list