aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes query regarding EJB transactions. 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 "query regarding EJB transactions." Watch "query regarding EJB transactions." New topic
Author

query regarding EJB transactions.

mohan kumar r
Ranch Hand

Joined: Jan 19, 2006
Posts: 38
Hi,my application architecture is JSP->controller servlet-->EJB-->DAO.
1)can i call con.setAutoCommit(false) in the DAO's code even though i have been using container managed transactions.
2)when i am using container managed TXs, if i call two methods(say one is for insert and the other is for update) of the DAO from the method of SLS bean,will the trasaction maintained.ie if the one method executed and the other one fails,does the transaction rolled back.


mohan
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9327
    
110

2)when i am using container managed TXs, if i call two methods(say one is for insert and the other is for update) of the DAO from the method of SLS bean,will the trasaction maintained.ie if the one method executed and the other one fails,does the transaction rolled back.


Yes, the entire transaction will be rolled back, if a exception is thrown.


[My Blog] [JavaRanch Journal]
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Transaction3.html

Please read Rolling Back a Container-Managed Transaction


http://www.skillassert.com


mohan kumar r
Ranch Hand

Joined: Jan 19, 2006
Posts: 38
yes transaction will be roll backed provided the if we add context.setrollbackOnly()in the exception handling code of the ejb method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query regarding EJB transactions.
 
Similar Threads
JDBC and Oracle : not working as I expected
Container Managed Transactions with an MDB
Transaction EJB session bean
Transacation Behavior When Exceptions Are Thrown
CMT