Hi out there, 
i have a little problem with transactions (its my first try to use them...). 
Following Scenario: 
I want to call 2 methods of a Session Bean from a Servlet. Both methods are creating a 
new CMP-Object. 
Well...the first Object should be removed from Database if the second fails...So I 
thought why not using Transactions. 
This looks like the following: 

javax.naming.Context jndiContext = new javax.naming.InitialContext();
  | javax.transaction.UserTransaction ut = (javax.transaction.UserTransaction) 
jndiContext.lookup("UserTransaction");
  | ut.begin();
  | User user=sessionbean1.createNewUser();
  | Adress adress=sessionbean2.createNewAdress();
  | ut.commit;  
 
This code seems to work fine. If sessionbean2 fails, the correct ut.rollback() in the 
catch-Block (not shown above) is used (thanks to the debugger;)). But if I look in the 
Database, the entry from sessionbean1 is not removed... 
Where is the problem? 
Session Beans and CMP'S are both set to transaction type "supports" (with xdoclet). 
I'm using MySQL 4.0.15-nt (perhaps the database is the problem?). 
Cant I start transactions from the servlet??? 

Bye 

Mark

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

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


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to