{
obj = getObjectByAID(om, (ResultSet)rs, fieldNumbers, cmd, pcClassForObject, requiresInheritanceCheck);
}
else if (cmd.getIdentityType() == IdentityType.DATASTORE)
{
JavaTypeMapping mapping = new OIDMapping();
mapping.initialize(table.getStoreManager().getDatastoreAdapter(), pcClassForObject.getName());
mapping.addDataStoreMapping(table.getDataStoreObjectIdMapping().getDataStoreMapping(0));
Object id = mapping.getObject(om, rs, datastoreIdentityExpressionIndex);
if (fieldNumbers == null)
{
obj = om.findObject(id, false, requiresInheritanceCheck, null);
}
else
{
if (requiresInheritanceCheck)
{
obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, null);
}
else
{
obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, pcClassForObject);
}
}
}
else if (cmd.getIdentityType() == IdentityType.NONDURABLE)
{
Object id = om.newObjectId(className, null);
if (fieldNumbers == null)
{
obj = om.findObject(id, false, requiresInheritanceCheck, null);
}
else
{
obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, pcClassForObject);
}
}
// Set the version of the object where possible
int versionFieldNumber = -1;
VersionMetaData vermd = table.getVersionMetaData();
if (vermd != null && vermd.getFieldName() != null)
{
// Version stored in a normal field
// TODO Should only do this if the version was just retrieved
versionFieldNumber = acmd.getMetaDataForMember(vermd.getFieldName()).getAbsoluteFieldNumber();
StateManager objSM = om.findStateManager(obj);
Object verFieldValue = objSM.provideField(versionFieldNumber);
if (verFieldValue != null)
{
objSM.setVersion(verFieldValue);
}
}
if (versionIndex != null)
{
// Surrogate version column returned by query
JavaTypeMapping mapping = table.getVersionMapping(true);
Object version = mapping.getObject(om, rs, versionIndex);
StateManager objSM = om.findStateManager(obj);
objSM.setVersion(version);
}
return obj;