File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query regarding EJB transactions.

 
mohan kumar r
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Transaction3.html

Please read Rolling Back a Container-Managed Transaction
 
mohan kumar r
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes transaction will be roll backed provided the if we add context.setrollbackOnly()in the exception handling code of the ejb method.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic