aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes transaction in EJB 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "transaction in EJB 2" Watch "transaction in EJB 2" New topic
Author

transaction in EJB 2

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
Suppose i want to do something like updating few hundred records using my DAO class. I want a whole or nothing scenario -- either updating all or none.

1. If I do not use any EJB, what transaction method shall I use ? Can I use JTA ?

2. If I use a stateless session bean (EJB 2) for this action, how do I handle the transaction ? Shall I specify the transaction in config file ? If I specify it in config file, can I specify the transaction 'block' instead of a method ? i.e how do I ensure a small code block is in a transaction ? any example ?

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


1. If I do not use any EJB, what transaction method shall I use ? Can I use JTA ?

If you like. Or a JDBC transaction would do.


2. If I use a stateless session bean (EJB 2) for this action, how do I handle the transaction ? Shall I specify the transaction in config file ? If I specify it in config file, can I specify the transaction 'block' instead of a method ? i.e how do I ensure a small code block is in a transaction ? any example ?

Your transaction demarcation is at the method level. You would need to write an EJB method to perform your update.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: transaction in EJB 2