[hibernate-issues] [JIRA] (HHH-14073) HibernateExceptions are inconsistently wrapped or not wrapped in their JPA equivalents

Karl von Randow (JIRA) jira at hibernate.atlassian.net
Tue Jun 16 21:32:01 EDT 2020


Karl von Randow ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5b51195a2c5b580659f76217 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 ) HHH-14073 ( https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 ) HibernateExceptions are inconsistently wrapped or not wrapped in their JPA equivalents ( https://hibernate.atlassian.net/browse/HHH-14073?atlOrigin=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 )

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=5b51195a2c5b580659f76217 )

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=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14073#add-comment?atlOrigin=eyJpIjoiZDdmMmQxMTlhNGFmNGFkYjk5OWViMGJjZGE5OTA5YTUiLCJwIjoiaiJ9 )

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#100128- sha1:2f2218b )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200617/92670496/attachment.html 


More information about the hibernate-issues mailing list