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.
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