[jboss-user] [EJB 3.0 Users] - Re: How to catch JTA/JPA exception?

jaikiran do-not-reply at jboss.com
Wed Sep 2 03:18:38 EDT 2009


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)
  |  {
  |     ...
  |  }
  | 
  | }

 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252983#4252983

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252983



More information about the jboss-user mailing list