Using
- Java 1.6
- JBoss AS 7.1.1
- EclipseLink 2.4.1
- JTA
Updated Question
How do I suppress the stacktrace being thrown by JBoss when I handle the error on my own in a try catch with flush?
Question
I'm trying to persist a entity using em.persist(entity). If no database constraints are being violated everything works fine. But if persisting the entity violates a unique constraints exceptions are thrown. I'm using transactions handled by JBoss so the exception is thrown from another thread.
I've already figured out that I can handle these exceptions globally by setting eclipselink.exception-handler in persistence.xml.
My question is how do I catch and handle these exceptions locally?