Danilov Roman (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYzc5YmFhNTQz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16155?atlOrigin=eyJpIjoiYzc5Ym...
) HHH-16155 (
https://hibernate.atlassian.net/browse/HHH-16155?atlOrigin=eyJpIjoiYzc5Ym...
) Problem with @Generated and jdbc.batch_size (
https://hibernate.atlassian.net/browse/HHH-16155?atlOrigin=eyJpIjoiYzc5Ym...
)
Issue Type: Bug Affects Versions: 6.1.6, 6.1.7 Assignee: Unassigned Attachments:
hibernate-orm-6.zip Components: hibernate-core Created: 09/Feb/2023 03:58 AM Priority:
Major Reporter: Danilov Roman (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
)
After updating hibernate version from 5.6.12 to 6.1.6, a problem appeared.
If Entity has field with annotation @Generated () and hibernate’s properties have
parameter jdbc.batch_size > 0 then when new object of entity is saved to the database,
an error appears in the logs and the saving does not occur.
The error occurs in the class
org.hibernate.metamodel.mapping.internal.GeneratedValuesProcessor.
And the problem is that when in entity there is an annotation @Generated over the field,
then in hibernate, first, it is saved in the database, and then these generated fields are
received from the database. And apparently, when there is jdbc.batch_size > 0 setting,
then INSERT to the database does not occur immediately, and SELECT tries to find a line in
the database that is not there yet.
With the old version of hibernate 5.6.12 everything worked without errors.
Link to
https://discourse.hibernate.org/t/problem-with-generated-and-jdbc-batch-s...
(
https://discourse.hibernate.org/t/problem-with-generated-and-jdbc-batch-s... ) with
more info.
And i have attached test cases.
(
https://hibernate.atlassian.net/browse/HHH-16155#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16155#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#100215- sha1:a0f3b6a )