BeanStateSynchronization pmcontract = (BeanStateSynchronization)inv.ejb;
pmcontract.ejb__flush();
} catch( Throwable ex ) {
//check the type of the method and create the corresponding exception
if( invInfo.startsWithCreate ) {
CreateException ejbEx = new CreateException();
ejbEx.initCause(ex);
inv.exception = ejbEx;
} else if( invInfo.startsWithRemove ) {
RemoveException ejbEx = new RemoveException();
ejbEx.initCause(ex);
inv.exception = ejbEx;
} else {
EJBException ejbEx = new EJBException();
ejbEx.initCause(ex);
inv.exception = ejbEx;
}
return;
}