Closed
Description
Eric Sirianni opened SPR-7933 and commented
The convertHibernateAccessException() method in SessionFactoryUtils does not properly chain the source HibernateException into the transformed Spring IncorrectResultSizeDataAccessException.
if (ex instanceof NonUniqueResultException) {
return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
}
The root HibernateException is swallowed, and along with it the stack trace with the actual line of code that generated the Hibernate error. This makes it nearly impossible to debug these failures.
The rest of the 'if' branches in convertHibernateAccessException() do appear to be properly chaining the underlying HibernateException into the newly constructed Exception:
if (ex instanceof PropertyValueException) {
return new DataIntegrityViolationException(ex.getMessage(), ex);
}
if (ex instanceof PersistentObjectException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
Affects: 3.0.5
Issue Links:
- Introduce (Annotation)SessionFactoryBuilder types [SPR-8066] #12721 Introduce (Annotation)SessionFactoryBuilder types ("depends on")
Referenced from: commits b0b1116
5 votes, 0 watchers