Hello, guys
I am trying to deal with exceptions thrown by an entity listener, more specifically in order to create som default validation device. Anyway, spec section 3.5.6 says that a lifecycle callback entity listener may throw a RuntimeException. My intention is to throw an @ApplicationException-annotated exception and catch it. My problems start because I would have to catch it during flush time, which occurs after the business method (in the case of a session EJB) finishes. So it is of no use to enclose the method in a try/catch block. I tried flushing the EntityManager at the end of my business method, but some problems happened when I performed calls to other business methods in the same transaction.
So, is there a way to create a "flush listener", or in some other way catch some exception before it goes all the way up to the client?
Henrique
_________________ Henrique Sousa
Don't forget to rate useful responses
|