• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Transactions and MDBs

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Need ur inputs about using Container Managed Transaction with MDBs.

I have a MDB which uses some helper classes and a Stateless Session Bean for performing its business logic. I am using Container Managed Transaction for the MDB. Do I need to seperately specify the transaction attribute for the Stateless Session Bean this MDB uses or will it be automatically included in the MDB's transaction.
According to Ed Roman:
If you use Conatiner Managed Transaction, MDB will read off the message in the same transaction as it performs its business logic.

Also how can I test that transactions are working as expected.

Thanks,
Nidhi
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want the Stateless Session Bean's methods to run inside the transaction started by the MDB, you should use "Required" as a <trans-attribute>.
For example, if inside onMessage() you are calling a session bean named ProcessSession, inside the deployment descriptor for this session bean you should have:
<container-transaction>
<method>
<ejb-name>ProcessSession</ejb-name>
<method-name>methodName or '*' for all methods</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
Inside Ed Roman's "Mastering EJB 2nd edition" you can find a pretty detailed explanation about Container Managed Transaction.
cheers
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic