log.debug("++++ LongLivedSessionPropagationInterceptor");
StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
if (extendedPCs == null || extendedPCs.size() == 0)
{
return invocation.invokeNext();
}
TransactionManager tm = TxUtil.getTransactionManager();
if (tm.getTransaction() != null)
{
for (String kernelname : extendedPCs.keySet())
{
EntityManager manager = extendedPCs.get(kernelname);
ManagedEntityManagerFactory factory = PersistenceUnitRegistry.getPersistenceUnit(kernelname).getManagedFactory();
factory.registerExtendedWithTransaction(manager);
}
}
return invocation.invokeNext();