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;