Unique constraint violation Exception during insertion sorts

Description

Update
On Hibernate core 5.2.8,

When the property hibernate.order_inserts is set to true, hibernate sorts the inserts. This sorting logic is adding a new EntityInsertAction which is a duplicate of already existing EntityInsertAction causing the following exception:

Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (BLANK_DB.SYS_C002312225) violated

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:910)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
at oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3865)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3845)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:205)
... 27 more
Caused by: Error : 1, Position : 0, Sql = insert into PhoneNumber (phoneNumber, id) values (:1 , :2 ), OriginalSql = insert into PhoneNumber (phoneNumber, id) values (?, ?), Error Msg = ORA-00001: unique constraint (BLANK_DB.SYS_C002312225) violated

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
... 42 more

Environment

None

Activity

Show:
Aman Garg
December 1, 2017, 6:26 AM

testcase is attached

Gail Badner
December 4, 2017, 12:36 PM

, there have been several bug fixes related to sorting inserts since 5.2.8. Is this still an issue in 5.2.12?

Aman Garg
December 5, 2017, 11:10 AM

@Gail Badner This bug doesn't exist on version 5.2.12, could you please back port those changes to 5.2.8?

Gail Badner
December 5, 2017, 1:04 PM

, we don't backport to previous versions. You'll need to move to 5.2.12 or backport yourself.

Assignee

Gail Badner

Reporter

Aman Garg

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure