Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate5 LocalSessionFactoryBean does not translate javax.persistence exceptions [SPR-14455] #19024

Closed
spring-projects-issues opened this issue Jul 12, 2016 · 1 comment
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 12, 2016

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:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 13, 2016

Juergen Hoeller commented

Analogous to HibernateJpaDialect, our Hibernate 5 HibernateExceptionTranslator detects a HibernateException root cause of a PersistenceException now, and delegates to EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible for plain PersistenceException handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants