• Post Reply Bookmark Topic Watch Topic
  • New Topic

BMT

 
Saha Kumar
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Can I start BMT using UserTransaction in a POJO and propagate the transaction to another POJO? The transaction would not be used by a SLSB, but would be used by POJOs which were instantiated by a SLSB.

Thanks in advance.

-Saha
 
Saha Kumar
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Could someone tell me if the following is a good practice or is valid use of BMT.

- A SLSB is executing code without CMT or BMT

- The SLSB instantiates and calls a method in a POJO with its javax.ejb.SessionContext as a parameter.

- The POJO uses context.getUserTransaction() to start a transaction, then performs a database update.

- The POJO then instantiates and calls a method in a different POJO which then executes some code in the same transaction.

- The second POJO returns to the first where the transaction is either rolled back or committed

Thank you in advance.

-Saha
 
Saha Kumar
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have answered my question.

I'll create a class which contains UserTransaction (obtained from SLSB facade ejbcontext), and use it in the pojos. This should work since SLSB are single-threaded. Note that this functionality is not available for servlets. In the servlet case, a transaction cannot span multiple servlets. But pojos instantiated from a SLSB can use the same transaction.

Sorry for the question.

-Saha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!