Hi, I have an EJB calling a DAO. A connection object is passed to the DAO. the DAO is further calling other DAOs sharing the same connection. The problem that I am having is that if some DAO in the chain throws an SQLException the earlier DAOs txn is not rolled back. There is no commit inside the DAOs.
I am using CMT EJB in weblogic 8.1. Thanks for any help.
Originally posted by somkiat puisungnoen: Why you use DAO with CMP Entity Bean ?
I thought he said CMT. not CMP. He is probaly referring to a session bean facade i guess. ------------------ Anyways make sure you use txdatasource while configuring it. Catch the SQLException in your session bean and do setRollbackOnly on the sesion context.
You have two choices here. If you want to continue having RemoteException thrown, or you want to throw your own application exception (not a subclass of RuntimeException), you need to tell the container to rollback the transaction. I have the following method in my base EJB:Your other option is to throw any exception that extends RuntimeException or one of its subclasses -- a system exception. In that case the container will rollback the transaction.
subject: Txn not automatically rolling back after RemoteException