I have a system that uses 100% container managed stateless session beans. I have a need to listen when a particular transaction is completed, then call another bean to do some additional work. (This is OC4j 9.0.3 by the way). I created an object that implements javax.transaction.Synchronization. In the afterCompletion() method, I instantiate my new bean and make the call. The problem is the container does not start a new transaction for this second call -- it runs the method without a transaction. The transaction attribute on the method is "Required".
- Posted by: John Pletka
- Posted on: February 20 2003 22:46 EST
Is this expected behavior, or is it a bug with Oracle's app server? If this is expected behavior, does anyone know of another way to safely listen for transaction commit events? Am I allowed to start a transaction manually from a Synchronization listener from the afterCompletion() call?
- Starting new transaction from Synchronization listener by Kiran Nallam on February 21 2003 00:18 EST
Good question. Here one thing you need to know bcs your session be implements with SessionSynchronization once you call a method of remote interface the transaction will be committed or rollback after your aftercompletion method finished. Since ejb does not support nested transactions your requirement will not possible. You can call your second transaction once you finish your first transaction. I mean you can write one more method in session bean or where you are calling session bean and then you can call that method once your first transaction completes.