Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes EJB: CMT Commit the transactions till exception raised 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 "EJB: CMT Commit the transactions till exception raised" Watch "EJB: CMT Commit the transactions till exception raised" New topic
Author

EJB: CMT Commit the transactions till exception raised

T. Sravan Kumar Reddy
Greenhorn

Joined: Sep 30, 2013
Posts: 1
Hi,

Request you help me on the below issue.

I am using Contaier managed beans in EJB, calling the DAO method from Session bean and executing the same. DAO method have internal iterations, to insert the data into Database.
My requirement is that, Interative transactions should be commited till exception raised in loop without using the commit() statement.

If i call the setRollbackOnly() method in the exception block, it is rollbacking total transaction.


Regards,
Sravan
Dieter Quickfend
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
If I understand correctly, you want one transaction per DB insertion. So put the iteration in your service method, and in your DAO you have a single insert with a transaction attribute of REQUIRES_NEW.


Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB: CMT Commit the transactions till exception raised
 
Similar Threads
CMT
Transaction EJB session bean
Stateless Session Beans Managing JDBC Transactions
Transacation Behavior When Exceptions Are Thrown
Throwing EJBException from a Method