Description
Will Darby opened SPR-14455 and commented
Hibernate 5.0 deprecated the Criteria API resulting in a migration to the JPA CriteriaQuery API directly supported by the Hibernate Session. Exceptions thrown using the CriteriaQuery API derive from package javax.persistence rather than org.hibernate.exception. The Hibernate5 LocalSessionFactoryBean.translateExceptionIfPossible does not convert these exceptions automatically, requiring the addition of a new PersistentExceptionTranslator. The HibernateJpaDialect does translate javax.persistence exceptions correctly but is not used when a LocalSessionFactoryBean is used.
I believe Hibernate5 LocalSessionFactoryBean.translateExceptionIfPossible should match the implementation of HibernateJpaDialect for translating exceptions since JPA is natively integrated with Hibernate 5.
Affects: 4.3 GA, 4.3.1
Issue Links:
- Support for Hibernate ORM 5.2 [SPR-14327] #18899 Support for Hibernate ORM 5.2
- Flush exception translation not working anymore with Hibernate 5.2 [SPR-14457] #19026 Flush exception translation not working anymore with Hibernate 5.2
- HibernateExceptionTranslator translating to InvalidDataAccessApiUsageException when using vanilla Hibernate [SPR-14681] #19245 HibernateExceptionTranslator translating to InvalidDataAccessApiUsageException when using vanilla Hibernate
- LocalSessionFactoryBean and HibernateTransactionManager for JPA EntityManagerFactory setup [SPR-17002] #21540 LocalSessionFactoryBean and HibernateTransactionManager for JPA EntityManagerFactory setup
- Remove outdated JpaExceptionTranslatorAspect [SPR-15047] #19613 Remove outdated JpaExceptionTranslatorAspect