I've got an exception without the proper cause, making it difficult to understand what happened:
Using a breakpoint in TransactionImpl I see wrappedException = e.getCause(); (line 70), which returns null.
In my case, the exception was javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session.
I assume a check should be done and use the exception itself if the cause is null.
Sure. You need to extend org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase and supply the interceptor like this:
I made a test and the interceptor doesn't work for this because all the exceptions are caught and don't cause a transaction failure. I'll cherry pick your change and create a test case and commit it like that.
Merged it into master and the 5.0 branch.