Object actual = oid.getClass();
// embedded id and derived id
if (pks.length > 0 && (pks[0].isEmbedded() || pks[0].isTypePC())) {
if (pks[0].getDeclaredType().equals(oid.getClass())) {
return new ObjectId(cls, oid);
}
expected = pks[0].getDeclaredType();
}
if (oidType != null && oidType.equals(oid.getClass())) {
// Check for compound id class
return new ObjectId(cls, oid);
}
if (meta.getIdentityType() == ClassMetaData.ID_DATASTORE) {
// no id field
try {
return new Id(cls, ((Number) oid).longValue());