Description
Joram Agten opened SPR-17015 and commented
If using both jdbc and hibernate-orm (hibernate 5) in a spring project, only jdbc translates db error codes to custom DataAccessException
when configuring them in sql-error-codes.xml
.
Hibernate-orm only maps to the standard set of DataAccessException
.
In org.springframework.orm.hibernate3.HibernateExceptionTranslator#convertHibernateAccessException
the jdbcExceptionTranslator
is used.
This allows with the configuration of sql-error-codes.xml
to map exceptions to custom DataAccessException
's
In org.springframework.orm.hibernate5.HibernateExceptionTranslator#convertHibernateAccessException
(and also the one for hibernate4) this jdbcExceptionTranslator
is no longer used.
temporary solved with attached DataAccessExceptionTranslatorHibernateJpaDialect.java
this is then configured as jpaDialect
on the entityManagerFactory
Affects: 4.3.13
Attachments:
Issue Links:
- LocalSessionFactoryBean and HibernateTransactionManager for JPA EntityManagerFactory setup [SPR-17002] #21540 LocalSessionFactoryBean and HibernateTransactionManager for JPA EntityManagerFactory setup
- Propagate read-only status to Hibernate Session through setDefaultReadOnly [SPR-16956] #21494 Propagate read-only status to Hibernate Session through setDefaultReadOnly
Referenced from: commits d9e8d3b