JTA - Propogation of Transactions
I have a question in relation to implementing Optimistic-Locking on Weblogic 8.
I have a session bean method using CMT which is set to 'Required'. This in turn makes a call to an entity bean method which also has its transactional attribute set to 'Required'. On the pretence that during the invocation of the entity bean method, a concurrent access occurs and this causes the transaction residing within the entity bean to roll back, will this propogate to the session bean method?
If so would this mean that one way in which to detect a concurrent access would be to check the 'getRollbackOnly()' state of the transaction at the end of the session bean method, i.e.:
@ejbgen:session default-transaction="Required"
someBusinessMethod(id)throws AccessViolationException
{
AccountEntityLocalHome accELH = getAccountEntityLocalHome();
AccountEntityLocal acc = accELH.findByPrimaryKey(id);
acc.updateBalance(2000);
if (_ctx.getRollbackOnly())
{
thrownew AccessViolationException();
}
}
Thanks in advance.

