O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bean-Managed Transactions

Using BMT, the transaction is controlled programmatically in the code surrounding the update operations. BMT allows transaction demarcation, the selection of transaction boundaries, to be any arbitrary location in the code, as shown in the following example.

 ... javax.transaction.UserTransaction ut; javax.ejb.EJBContext context; ... try { // // establish the connections and create the // statements // InitialContext init = new InitialContext(); DataSource accountingDS = init.lookup( "java:comp/env/jdbc/accounting"); DataSource legacyAccountingDS = init.lookup( "java:comp/env/jdbc/accountingL"); java.sql.Connection conAcctg = accountingDS.getConnection(); java.sql.Connection conLegacy = accountingDS.getConnection(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required