Nara Simha (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63f1102...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMjU2NTZlYzQy...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16502?atlOrigin=eyJpIjoiMjU2NT...
) HHH-16502 (
https://hibernate.atlassian.net/browse/HHH-16502?atlOrigin=eyJpIjoiMjU2NT...
) Hib5: @OneToOne mapping with unique=true throws "caused a duplicate key value in a
unique or primary key constraint' (
https://hibernate.atlassian.net/browse/HHH-16502?atlOrigin=eyJpIjoiMjU2NT...
)
Change By: Nara Simha (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63f1102...
)
The following mapping works fine in Hib 3.x
{noformat}@OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, optional =
true)
@JoinColumn(name = PAYLOAD_FILTER_COLUMN "PAYLOAD_FILTER" , unique = true)
private PayloadFilterExpression payloadFilter;{noformat}
!dampen-20230424-054645 (7efd1ac9-095c-4083-a638-335bedcd1efd).png|width=1667,height=937!
+*_The same mapping throws the following error in Hib 5.x_*+
{noformat}This table, NMS_DAMPEN_CONFIG has a one-to-one relationship with
NMS_PAYLOAD_FILTER_EXPR table.
This column, PAYLOAD_FILTER is populated based on index col value of
NMS_PAYLOAD_FILTER_EXPR
The unique key needs to be relaxed in order to proceed with the inserts else we hit the
following issue:
"2023-04-10 01:35:02.749 ERROR
[org.hibernate.engine.jdbc.batch.internal.BatchingBatch] HHH000315:
Exception executing batch [java.sql.BatchUpdateException: The statement was aborted
because it would
have caused a duplicate key value in a unique or primary key constraint or unique index
identified by
'UK_HJWHE1QKYLIS421SH7BTMYPH1' defined on 'NMS_DAMPEN_CONFIG'.], SQL:
insert into NMS_DAMPEN_CONFIG
(UUID, VERSION, ENABLE, HR_INTERVAL, MIN_INTERVAL, PAYLOAD_FILTER, SEC_INTERVAL, ID)
values (?, ?, ?, ?, ?, ?, ?, ?){noformat}
(
https://hibernate.atlassian.net/browse/HHH-16502#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16502#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#100223- sha1:77dfe11 )