Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *commented* on HHH-16319 (
https://hibernate.atlassian.net/browse/HHH-16319?atlOrigin=eyJpIjoiNzJjOD...
)
Re: H6: Problem with order insert to table with batch is ON (
https://hibernate.atlassian.net/browse/HHH-16319?atlOrigin=eyJpIjoiNzJjOD...
)
Hello Danilov Roman (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) , thank you for reporting the issue and providing a reproducer.
The error is caused by the @Generated property in the Interpretation entity: to be able to
retrieve insert-generated values correctly Hibernate has to disable batching for entities
having that annotation. This causes the order of operations to be changed: instead of
inserting InterpretationData first, that gets added to the batch queue whereas the
Interpretation insert is executed immediately, causing the foreign key error.
You will have to either manually flush when inserting the parent entity or handle inserts
in different transactions.
(
https://hibernate.atlassian.net/browse/HHH-16319#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16319#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#100219- sha1:0c2c9f2 )