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.

[1367 byte] By [rotan_imretxea] at [2007-10-2 16:14:21]
# 1

Hi. Two things:

1 - You can't assume that if you discover the tx is

setRollbackOnly that it was because of an illegal

access. For instance, the tx could have simply timed

out.

2 - FInd the weblogic developer news groups from the BEA site.

You may get quicker help there.

Joe Weinstein at BEA Systems

Joe_Weinsteina at 2007-7-13 17:02:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...