Hi
The J2EE Sun tutorial 
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Transaction4.html#wp80007 
specifically instructs:
 anonymous wrote : Do not invoke the getRollbackOnly and setRollbackOnly 
methods of the EJBContext interface in bean-managed transactions. These methods 
should be used only in container-managed transactions. For bean-managed 
transactions, invoke the getStatus and rollback methods of the UserTransaction 
interface.

However, the JBoss-Wiki page 
http://wiki.jboss.org/wiki/Wiki.jsp?page=WhatIsTheCorrectPatternForUserTransactions
 instructs (in the example) to use setRollbackOnly() method:
UserTransaction ut = ... // e.g. new 
InitialContext().lookup("java:comp/UserTransaction");
  | ut.begin();
  | try
  | {
  | // DO SOMETHING
  | }
  | catch (Exception e)
  | {
  |    ut.setRollbackOnly(); // Force a rollback for this error
  |    throw e;
  | }
  | finally
  | {
  |    if (ut.getStatus() == Status.STATUS_ACTIVE)
  |       ut.commit();
  |    else
  |       ut.rollback();
  | }
  | 

Can anyone shed some light on this alleged contradiction?

Thanks

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to