HibernateExceptionTranslator avoids JPA IllegalState/ArgumentException translation

Issue: SPR-14681
This commit is contained in:
Juergen Hoeller 2016-09-13 21:46:02 +02:00
parent 480cd2c2f0
commit 34ab818dfa
1 changed files with 6 additions and 3 deletions

View File

@ -48,10 +48,13 @@ public class HibernateExceptionTranslator implements PersistenceExceptionTransla
if (ex instanceof HibernateException) {
return convertHibernateAccessException((HibernateException) ex);
}
if (ex instanceof PersistenceException && ex.getCause() instanceof HibernateException) {
return convertHibernateAccessException((HibernateException) ex.getCause());
if (ex instanceof PersistenceException) {
if (ex.getCause() instanceof HibernateException) {
return convertHibernateAccessException((HibernateException) ex.getCause());
}
return EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex);
}
return EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex);
return null;
}
/**