[jboss-user] [JBoss Seam] - Re: Can I manually commit a Transaction?

dustismo do-not-reply at jboss.com
Wed Sep 26 18:08:49 EDT 2007


Handling your own transaction in seam is a nasty business, but here's how to do it :)

in components.xml :


  | <core:init debug="true" jndi-pattern="@jndiPattern@"
  |    	user-transaction-name="java:/UserTransaction" />
  | 


to commit a transaction:

  | UserTransaction tx = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); 
  | entityManager.flush();
  | if (tx.getStatus() == Status.STATUS_ACTIVE) 
  | 	tx.commit();
  | 


You'll probably need to start another transaction in order to avoid seam throwing 'no transaction' exceptions when the request is finished. 

good luck,
-Dustin

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

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



More information about the jboss-user mailing list