I'm using EJB3 with jboss-4.0.5.GA. As usual, i'll use the EntityManager's API to do CRUD operation, such as, em.persist(), em.merge() etc.
The problem here is that it seems like i'm unable to catch database persistence exception in the session bean. I'm only able to catch it in the delegate. All this is due to the behaviour of the container where it doesn't commit immediately. I'm using CMT/CMP.
I've read about using em.flush(), but are there any other way? Because i read that using this will affect the performance. How do you guys catch persistence exception? I need to catch it in the session bean (not the client) so that i'm able to do logging in the back end.
Please advise. Thanks.