Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

My session beans call other bean methods within a transaction. Using bean-managed transactions, how should I take care of commit and rollback ?

0
Posted

My session beans call other bean methods within a transaction. Using bean-managed transactions, how should I take care of commit and rollback ?

0

Location: http://www.jguru.com/faq/view.jsp?EID=62121 Created: Jun 2, 2000 Modified: 2000-09-12 15:55:36.874 Author: Siva Visveswaran (http://www.jguru.com/guru/viewbio.jsp?EID=46210) Question originally posed by Shalabh Nigam (http://www.jguru.com/guru/viewbio.jsp?EID=47481 There are two steps here: 1. Coding step: public class exBean implements SessionBean { EJBContext ec; javax.transaction.UserTransaction utxn; . . . utxn = ec.getUserTransaction(); utxn.begin(); // do all your txn stuff // getting DB connections, updates, other bean methods, etc. . . utxn.commit(); } Note you have to begin a txn before opening dB connections and close connections before committing. 2. Deployment step: – Your app server must support a JTS for distributed txns. Most do. – Verify there is no conflict with the bean transaction properties in calling beans.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123