[jboss-user] [EJB 3.0] - Re: Bug? Transaction timeout....

peter_kaas do-not-reply at jboss.com
Thu Jul 27 03:55:45 EDT 2006


What if you mark your MDB with:


  | @TransactionManagement(TransactionManagementType.BEAN)
  | 

and then roll your own transaction like:


  | @Resource
  | private transient MessageDrivenContext context;
  | 
  | ...
  | 
  | UserTransaction ut = null;
  | 
  | try {
  |    ut = context.getUserTransaction();
  |    ut.setTransactionTimeout(TIMEOUT);
  |    ut.begin();
  | 
  |    // Do your stuff
  | 
  |    ut.commit();
  | } catch (Throwable ex) {
  |    try { if (ut != null) ut.rollback(); } catch (Throwable ex2) { }
  | 
  |    ...
  | }
  | 



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

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



More information about the jboss-user mailing list