public Object invokeHome(Invocation mi) throws Exception {
// Invoke through interceptors
Object retVal = getNext().invokeHome(mi);
// Is the context now with an identity?
// This means that a create method was called, so invoke ejbPostCreate.
EntityEnterpriseContext ctx =
(EntityEnterpriseContext) mi.getEnterpriseContext();
if(ctx != null && ctx.getId() != null)
{
// copy from the context into the mi
// interceptors down the chain look in the mi for the id not the ctx.
mi.setId(ctx.getId());
// invoke down the invoke chain
// the final interceptor in EntityContainer will redirect this
// call to postCreateEntity, which calls ejbPostCreate
getNext().invoke(mi);
// now it's ready and can be scheduled for the synchronization
if(TxUtils.isActive(mi.getTransaction()))
{
GlobalTxEntityMap.NONE.scheduleSync(mi.getTransaction(), ctx);
}
}
return retVal;
}
|