if (meta.isOpenJPAIdentity()) {
// use meta type instead of oid type in case it's a subclass
Class cls = meta.getDescribedType();
OpenJPAId koid = (OpenJPAId) oid;
FieldMetaData pk = meta.getPrimaryKeyFields()[0];
switch (pk.getObjectIdFieldTypeCode()) {
case JavaTypes.BYTE:
case JavaTypes.BYTE_OBJ:
return new ByteId(cls, ((ByteId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.CHAR:
case JavaTypes.CHAR_OBJ:
return new CharId(cls, ((CharId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.DOUBLE:
case JavaTypes.DOUBLE_OBJ:
return new DoubleId(cls, ((DoubleId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.FLOAT:
case JavaTypes.FLOAT_OBJ:
return new FloatId(cls, ((FloatId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.INT:
case JavaTypes.INT_OBJ:
return new IntId(cls, ((IntId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.LONG:
case JavaTypes.LONG_OBJ:
return new LongId(cls, ((LongId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.SHORT:
case JavaTypes.SHORT_OBJ:
return new ShortId(cls, ((ShortId) oid).getId(),
koid.hasSubclasses());
case JavaTypes.STRING:
return new StringId(cls, oid.toString(),
koid.hasSubclasses());
case JavaTypes.OID:
ClassMetaData embed = pk.getEmbeddedMetaData();
Object inner = koid.getIdObject();
if (embed != null)
inner = copy(inner, embed, embed.getFields());
return new ObjectId(cls, inner, koid.hasSubclasses());
case JavaTypes.OBJECT: