This content has been marked as final.
Show 3 replies
-
1. Re: How to catch JTA/JPA exception?
jaikiran Sep 2, 2009 3:18 AM (in response to gackonac)The flush to DB automatically happens on a tx commit. So the exception happens during the onCommit callbacks of tx. If you want the DB operation to be run immidiately, then use the flush() to explicitly flush it to DB and catch the exception:
onMessage() { try { em.update...(...); // flush em.flush(); } catch (Exception e) { ... } }
-
2. Re: How to catch JTA/JPA exception?
gackonac Sep 2, 2009 10:34 AM (in response to gackonac)Thanks for you answer Jaikiran.
But that is more like "workaround" solution. In more general case (global/server) transaction can fail because of some other reason (JPA/SQL exception is just one of them).
So, is there any callback method/interface to be implemented by app, in order to get info from server about JTA status/actions? -
3. Re: How to catch JTA/JPA exception?
jaikiran Sep 2, 2009 11:17 AM (in response to gackonac)"gackonac" wrote:
So, is there any callback method/interface to be implemented by app, in order to get info from server about JTA status/actions?
http://java.sun.com/javaee/5/docs/api/javax/transaction/Synchronization.html