Sunday, June 11, 2006

obtaining user transaction of the client from inside the bean

To control transactions from client code, you must look up the JTA UserTransaction interface with the Java Naming and Directory Interface (JNDI). JNDI is a generic lookup facility for looking up resources across a network, and it is fully described in Appendix A. The following code illustrates looking up the JTA UserTransaction interface from client code using JNDI:
/*
* 3: Look up the JTA UserTransaction interface
* via JNDI. The container is required to
* make the JTA available at the location
* java:comp/UserTransaction.
*/
userTran = (javax.transaction.UserTransaction)
ctx.lookup("java:comp/UserTransaction");

Wont this collide with any other usertransaction created by other client. How is the integrity assured?

No comments: