Karl von Randow (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5b51195...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDdmMmQxMTlh...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMm...
) HHH-14073 (
https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMm...
) HibernateExceptions are inconsistently wrapped or not wrapped in their JPA equivalents (
https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMm...
)
Issue Type: Bug Affects Versions: 5.4.17 Assignee: Unassigned Components: hibernate-core
Created: 16/Jun/2020 18:32 PM Priority: Major Reporter: Karl von Randow (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5b51195...
)
org.hibernate.internal.ExceptionConverterImpl converts HibernateException into their JPA
equivalents. In convertCommitException it checks if the Hibernate stack was bootstrapped
via JPA or Hibernate natively, and only converts the exception if the stack was
bootstrapped via JPA.
However, the generic convert(HibernateException e, LockOptions lockOptions) method, does
not consider whether the stack was bootstrapped via JPA.
HHH-12666 (
https://hibernate.atlassian.net/browse/HHH-12666 ) Closed introduced an
additional configuration flag, nativeExceptionHandling51Compliance , but there is an
inconsistency in the treatment of HibernateException if isJpaBootstrap is false and
nativeExceptionHandling51Compliance is also false (the default).
The inconsistency results in some HibernateException being wrapped (if from a commit), and
others not being (e.g. from a flush), so in the same application you can see a
ConstraintViolationException and a PersistenceException containing a
ConstraintViolationException. Ouch.
I think nativeExceptionHandling51Compliance is redundant, and instead the wrapping
behaviour should only be triggered by isJpaBootstrap.
(
https://hibernate.atlassian.net/browse/HHH-14073#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14073#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#100128- sha1:2f2218b )