use of com.sun.jdo.api.persistence.support.JDOObjectNotFoundException in project Payara by payara.
the class JDOEJB11HelperImpl method convertPrimaryKeyToPC.
/**
* Converts PrimaryKey object to persistence-capable instance.
* @param key the PrimaryKey object to be converted.
* @param pm the associated instance of PersistenceManager.
* @param validate true if the existence of the instance is to be validated.
* @return persistence-capable instance.
* @throws IllegalArgumentException if validate is true and instance does
* not exist in the database or is deleted.
*/
protected Object convertPrimaryKeyToPC(Object key, PersistenceManager pm, boolean validate) {
Object pc = null;
try {
Object jdoObjectId = convertPrimaryKeyToObjectId(key);
pc = pm.getObjectById(jdoObjectId, validate);
} catch (JDOObjectNotFoundException ex) {
// NOI18N
logger.fine("---JDOEJB11HelperImpl.convertPrimaryKeyToPC: Object not found for: " + key);
throw new IllegalArgumentException(I18NHelper.getMessage(messages, "EXC_DeletedInstanceOtherTx", // NOI18N
key.toString()));
}
if (validate && JDOHelper.isDeleted(pc)) {
// NOI18N
logger.fine("---JDOEJB11HelperImpl.convertPrimaryKeyToPC: Object is deleted for: " + key);
throw new IllegalArgumentException(I18NHelper.getMessage(messages, "EXC_DeletedInstanceThisTx", // NOI18N
key.toString()));
}
return pc;
}
Aggregations