You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the spring-orm class org.springframework.orm.jpa.vendor.HibernateJpaDialect translates Hibernate exceptions to Spring exceptions, but these exceptions can be wrapped in instances of org.hibernate.sql.exec.ExecutionException as I have noticed. As a result, such an exception is translated into a generic org.springframework.orm.jpa.JpaSystemException, which is a pity, as I would like to add retry behavior around a deadlock occurrence, but only then.
In concrete, a org.hibernate.exception.LockAcquisitionException is thrown by Hibernate, which is then wrapped into an org.hibernate.sql.exec.ExecutionException (on line 325 in org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl), which is then handled in an instance of org.springframework.orm.jpa.vendor.HibernateJpaDialect (method convertHibernateAccessException), and wrapped in a org.springframework.orm.jpa.JpaSystemException, since there is no translation for an ExecutionException.
I don't know if there are other cases where concrete translatable exceptions are 'lost' this way.
It would be nice if these wrapped exceptions could be unwrapped and translated, so we can act upon them correctly.
The text was updated successfully, but these errors were encountered:
Currently, the spring-orm class
org.springframework.orm.jpa.vendor.HibernateJpaDialect
translates Hibernate exceptions to Spring exceptions, but these exceptions can be wrapped in instances oforg.hibernate.sql.exec.ExecutionException
as I have noticed. As a result, such an exception is translated into a genericorg.springframework.orm.jpa.JpaSystemException
, which is a pity, as I would like to add retry behavior around a deadlock occurrence, but only then.In concrete, a
org.hibernate.exception.LockAcquisitionException
is thrown by Hibernate, which is then wrapped into anorg.hibernate.sql.exec.ExecutionException
(on line 325 inorg.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl
), which is then handled in an instance oforg.springframework.orm.jpa.vendor.HibernateJpaDialect
(methodconvertHibernateAccessException
), and wrapped in aorg.springframework.orm.jpa.JpaSystemException
, since there is no translation for an ExecutionException.I don't know if there are other cases where concrete translatable exceptions are 'lost' this way.
It would be nice if these wrapped exceptions could be unwrapped and translated, so we can act upon them correctly.
The text was updated successfully, but these errors were encountered: