I am using OpenJPA and Glassfish.
I have an entity that uses the @PrePersist tag. If things don't go smoothly, I throw an exception. A typed exception, with useful information needed to provide the user with valuable feedback and make my application behave rationally.
There does not seem to be a way to get at that exception once I've thrown it however. The exception I do get a hold of is an EJBRolledbackTransactonException. It is caused, intuitively enough, by a javax.transaction.RolledbackTransactionException.
(As an aside, why EJBRollbackTransaction felt the need to define getCausedBy which returns null in this cause when getCause was already there is not clear but I digress)
RolledbackTransaction does have the info I need (nested three levels down but it's there) EXCEPT it's on a private field that is used to print its stack trace ('details').
Is there another way to get at it, and can you guys please fix this?
Thanks,
Benjamin
[Message sent by forum member 'therealbr' (therealbr)]
http://forums.java.net/jive/thread.jspa?messageID=264236