This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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: 10069
    
163

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.
 
Consider Paul's rocket mass heater.
 
subject: query regarding EJB transactions.