[hibernate-issues] [JIRA] (HHH-14041) H2Dialect does not correctly extract violated constraint names for 23506

gittenburg (JIRA) jira at hibernate.atlassian.net
Sun May 24 06:49:24 EDT 2020


gittenburg ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5eca45698d2e220c252a5c30 ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14041?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 ) HHH-14041 ( https://hibernate.atlassian.net/browse/HHH-14041?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 ) H2Dialect does not correctly extract violated constraint names for 23506 ( https://hibernate.atlassian.net/browse/HHH-14041?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 )

Change By: gittenburg ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5eca45698d2e220c252a5c30 )

For SQLState: 23506 h2 returns for example\[1] :

{noformat}Referential integrity constraint violation: "FK_PROGRESS_CARD: PUBLIC.PROGRESS FOREIGN KEY(CARD_ID) REFERENCES PUBLIC.CARDS(ID) (0)"; SQL statement:insert into progress (due, factor, card_id, user_id) values (?, ?, ?, ?) [23506-200]{noformat}

H2Dialect's ViolatedConstraintNameExtracter currently only strips away everything up to and including {{violation: }}, making {{constraintViolationException.getConstraintName()}} return {{"FK_PROGRESS_CARD: PUBLIC.PROGRESS FOREIGN KEY(CARD_ID) REFERENCES PUBLIC.CARDS(ID) (0)"; SQL statement:}}
{{insert into progress (due, factor, card_id, user_id) values (?, ?, ?, ?) [23506-200]}}, which is obviously wrong.

\[1]: [https://github.com/h2database/h2database/blob/9e2e212cf806fa75cd42437a13a33cb3185f5fb1/h2/src/main/org/h2/constraint/ConstraintReferential.java#L312|https://github.com/h2database/h2database/blob/9e2e212cf806fa75cd42437a13a33cb3185f5fb1/h2/src/main/org/h2/constraint/ConstraintReferential.java#L312]

( https://hibernate.atlassian.net/browse/HHH-14041#add-comment?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14041#add-comment?atlOrigin=eyJpIjoiNmY2MDAzZjZiNDM3NGE0ZjkwY2VkOTMwMWZlMzRhZTciLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100127- sha1:ff24dc8 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200524/1b2ebcf4/attachment-0001.html 


More information about the hibernate-issues mailing list