if (val == null)
return null;
beginOperation(false);
try {
ClassMetaData meta = _conf.getMetaDataRepositoryInstance().
getMetaData(cls, _loader, true);
switch (meta.getIdentityType()) {
case ClassMetaData.ID_DATASTORE:
// delegate to store manager for datastore ids
if (val instanceof String
&& ((String) val).startsWith(StateManagerId.STRING_PREFIX))
return new StateManagerId((String) val);
return _store.newDataStoreId(val, meta);
case ClassMetaData.ID_APPLICATION:
if (ImplHelper.isAssignable(meta.getObjectIdType(),
val.getClass())) {
if (!meta.isOpenJPAIdentity()
&& meta.isObjectIdTypeShared())
return new ObjectId(cls, val);
return val;
}
// stringified app id?