public EJBLocalObject getEJBLocalObjectForPrimaryKey
(Object pkey, EJBContext ctx) {
// EntityContextImpl should always be used in conjunction with EntityContainer so we can always cast
assert ctx instanceof EntityContextImpl;
EntityContextImpl context = (EntityContextImpl) ctx;
EJBLocalObjectImpl ejbLocalObjectImpl =
internalGetEJBLocalObjectImpl(pkey);
if (context.isCascadeDeleteBeforeEJBRemove()) {
JavaEETransaction current = null;
try {
current = (JavaEETransaction) transactionManager.getTransaction();
} catch ( SystemException ex ) {
throw new EJBException(ex);
}
ActiveTxCache activeTxCache = (current == null) ? null :
(ActiveTxCache) (ejbContainerUtilImpl.getActiveTxCache(current));
if (activeTxCache != null) {
EntityContextImpl ctx2 = (EntityContextImpl)
activeTxCache.get(this, pkey);
if ((ctx2 != null) &&
(ctx2.isCascadeDeleteAfterSuperEJBRemove())) {
return null;
}
}
return (EJBLocalObject) ejbLocalObjectImpl.getClientObject();
}
return (EJBLocalObject) ejbLocalObjectImpl.getClientObject();
}