{
xmlRply = (String)((EJBObject)entity).getPrimaryKey();
}
catch(RemoteException ex)
{
throw new XMLDispatcherSystemException(ex);
}
}
break;
}
}
// pack session data and return reply
return new XMLDispatcherRply(xmlRply,SessionData.packSessionData(xdCtx.getSession()));
}
catch(Throwable e)
{
// propagate error
if (e instanceof XMLDispatcherUserException)
{
if (pGetRollbackOnUserAndAppExceptions())
{
logcat.debug("Forcing a rollback due to UserException");
pSessionContext.setRollbackOnly();
}
logcat.error("Rethrowing UserException",e);
throw (XMLDispatcherUserException)e;
}
else if (e instanceof XMLDispatcherAppException)
{
if (pGetRollbackOnUserAndAppExceptions())
{
logcat.debug("Forcing a rollback due to AppException");
pSessionContext.setRollbackOnly();
}
logcat.error("Rethrowing AppException",e);
throw (XMLDispatcherAppException)e;
}
else if (e instanceof XMLDispatcherSystemException)
{
logcat.debug("Forcing a rollback due to SystemException");
pSessionContext.setRollbackOnly();
logcat.error("Rethrowing SystemException",e);
throw (XMLDispatcherSystemException)e;
}
else
{
logcat.debug("Forcing a rollback due to other exception");
pSessionContext.setRollbackOnly();
e = pUnwrapException(e);
logcat.error("Rethrowing (unwrapped) other exception as SystemException",e);
throw new XMLDispatcherSystemException(e);
}
}
finally
{
if (xdCtx != null)
{
try
{
xdCtx.doOnEndRequest();
}
catch(Exception e)
{
logcat.error("Caught exception while finishing transaction: rethrowing as SystemException",e);
throw new XMLDispatcherSystemException(e);
}
}
}
}