SetRollbackOnly and EJBException..what should happen?

I am wondering what peoples opinions are about what should happen when commiting a transaction in the following scenario.
I have a transaction started by a stateless session bean method. This method just finds an entity bean and sets one of its attributes. When this stateless session bean method finishes, the transaction is commited by the container. While commiting the transaction, the container calls the ejbStore method of the entity bean. The ejbStore method calls a method on a different stateless session ejb. This stateless session ejb method calls setRollbackOnly and throws an ApplicationException. The entity ejbStore method catches the ApplicationException and throws it nested within an EJBException.
The ejb2.0 spec says that the container should throw a javax.ejb.TransactionRolledbackLocalException if it can't commit a transaction. This is what I receive, but my question is what would you expect the nested transaction to be?
I would expect the EJBException that I threw from ejbStore to be the nested exception.
ie. I would expect this....
javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: javax.ejb.EJBException: nested exception is: au.com.sparq.test.ApplicationException: ApplicationException a b c...
But as soon as setRollbackOnly is called, I will only ever receive this exception....
javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: weblogic.transaction.internal.AppSetRollbackOnlyException
Why is an AppSetRollbackOnlyException being thrown by the container when I have told the container to rollback the transaction by throwing the EJBException from the ejbStore method of the entity ejb? In this case, the container shouldn't care that setRollbackOnly had been called. It should only be if the ejbStore method doesn't throw an EJBException that the AppSetRollbackOnlyException is thrown.
The side effect of this behaviour is that I can never get access to the ApplicationException thrown within the ejbStore method, so I can never tell what caused it to fail.

This is the expected behavior since Windows XP/Windows Server 2003.
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Similar Messages

Maybe you are looking for