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
Remove outdated JpaExceptionTranslatorAspect [SPR-15047] #19613
Comments
pas filip commented Juergen, I've noticed you changed the type of issue to an improvement however for me this is clearly a bug. Filip |
Juergen Hoeller commented It isn't quite a traditional Spring bug since the actual regression is caused by Hibernate 5.2's refactoring of its exception hierarchy, and Hibernate 5.2 is very recent still. Anyway, I've changed the type back to bug. |
Juergen Hoeller commented So previously, you received native Hibernate exceptions untranslated, and now you're receiving them within a I wonder whether we should keep the |
pas filip commented It seems I was a little too quick in creating this defect. Sorry for the trouble! About eliminating this aspect seems like a good option for me to remove it since:
|
Juergen Hoeller commented Alright, I'll simply remove the aspect in 5.0 for good then. |
pas filip opened SPR-15047 and commented
Hello,
I've recently upgraded to hibernate 5 and seem to have some issues receiving the correct translated exception when using spring's JpaExceptionTranslatorAspect.
Inside of the JpaExceptionTranslatorAspect the exception translation is immediately done by
EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible which doesn't seem to take into account the fix implemented in jira #19024.
So instead of receiving a org.springframework.dao.DataIntegrityViolationException we receive a JpaSystemException which contains the correct exception however it's not being translated.
Also would it be possible to perhaps adapt the JpaExceptionTranslatorAspect to delegate to a managed bean implementing org.springframework.dao.support.PersistenceExceptionTranslator
This could be a nice enhancement since the JpaExceptionTranslatorAspect is included with all the other spring aspects in the same jar and for weaving purposes simplifies things
as it should be possible to plug-in for example a translator that simply re-throws the exception if no translation is desired even though the aspect has been woven.
I can't entirely exclude that somehow there is an issue with my hibernate configuration but it seems the PersistenceExceptionTranslator implemented by the EntityManagerFactoryBean
isn't actually called at all which results in an incorrect translation.
Currently the only workaround I see, that seems to work, is to implement another aspect that implements the translation as specified in jira issue #19024.
Also seems related to jira issue #19026.
Issue Links:
Referenced from: commits cff311b
The text was updated successfully, but these errors were encountered: