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} |
|