I need to use the combination of stored procedure and entity beans such that in between the logic which is implemented in the session bean I need to call the stored procedure. This stored procedure makes some entries in the the table. My problem is that the entity beans which I am using are container managed, so if some exception occurs in the method after SP is invoked the rows inserted by procedure is not rolled back. Is there any solution to this?
The setRollbackOnly() method gives a bean the power to veto a transaction. This power can be used if the bean detects a condition that would cause inconsistent data to b e committed when the transaction completes. Once a bean invokes the setRollbackO nly() method, the current transaction is marked for rollback and cannot be commi tted by any other participant in the transaction--including the container.