Originally posted by Maggy Zhang:
When should I use first way ? when should I use the second way?
BMT allows you to have a better control over the scope of the transaction, also if you�re using statefull session beans you can use it to make a transaction scope around more than one method call, with CMT your control over transactions is restricted to methods.
The second question is:Can I use UserTransaction in javabean by JNDI lookup , suppose that the javabean run inside application server?
The specification API provides it and the method to get it stays like this(this method belongs to the EJBContext interface):