A stateful session bean instance may, but is not required to, commit a started transaction before a business method returns. If a transaction has not been completed by the end of a business method, the container retains the association between the transaction and the instance across multiple client calls until the instance eventually completes the transaction.
Originally posted by warren li:
No. You'll get an IllegalStateException.
You have to end a transaction before you start a new one. EJB 2.0 doesn't support nested transactions.
1. If Bean2 does not do commit then?
2. If Bean2 calls CMT which is of a stateful session bean that does not do commit immediately then?
Assume i hava a stateful session bean.
i have started a transaction by issuing userTransaction.begin() inside method A and it returns without commiting it.And the client now calls the method B which is again invoking the userTransaction.begin().
what will happen?.
For clarification, an EJB that
declares its transactional behavior with RequiresNew called within another transaction
is not an example of nested transactions. The containing transaction is suspended
while the new one executes, and resumes when the new transaction
completes. The �inside� transaction does not affect the first transaction. For EJBs,
transactions are either suspended or propagated.