try
{
status = transaction.getStatus();
if (status != Status.STATUS_ACTIVE)
{
throw new OJBRuntimeException(
"Transaction synchronization failed - wrong status of external container tx: " +
getStatusString(status));
}
}
catch (SystemException e)
{
throw new OJBRuntimeException("Can't read status of external tx", e);
}
try
{
//Sequence of the following method calls is significant
// 1. register the synchronization with the ODMG notion of a transaction.
transaction.registerSynchronization((J2EETransactionImpl) odmgTrans);
// 2. mark the ODMG transaction as being in a JTA Transaction
// Associate external transaction with the odmg transaction.
txRepository.set(new TxBuffer(odmgTrans, transaction));
}
catch (Exception e)
{
log.error("Cannot associate PersistenceBroker with running Transaction", e);
throw new OJBRuntimeException(
"Transaction synchronization failed - wrong status of external container tx", e);
}
}