// get DomainTypeHandler from StateManager
NdbOpenJPADomainTypeHandlerImpl<?> domainTypeHandler = getDomainTypeHandler(sm);
// get the value handler for the StateManager
ValueHandler valueHandler = domainTypeHandler.getValueHandler(sm, this);
// now flush based on current PCState
PCState pcState = sm.getPCState();
try {
if (pcState == PCState.PNEW) {
// flush new instance
session.insert(domainTypeHandler, valueHandler);
} else if (pcState == PCState.PDELETED) {
// flush deleted instance
session.delete(domainTypeHandler, valueHandler);
} else if (pcState == PCState.PDIRTY) {
// flush dirty instance
session.update(domainTypeHandler, valueHandler);
} else if (pcState == PCState.PNEWFLUSHEDDELETED) {
// flush new flushed deleted instance
session.delete(domainTypeHandler, valueHandler);
} else if (pcState == PCState.PNEWFLUSHEDDELETEDFLUSHED) {
// nothing to do
} else {
throw new ClusterJUserException(
local.message("ERR_Unsupported_Flush_Operation",
pcState.toString()));
}
} catch (Exception ex) {
if (logger.isDebugEnabled()) {
logger.debug("Exception caught: " + ex.toString());
}