if (obj != null && needToSetVersion)
{
// Set the version of the object where possible
if (surrogateVersion != null)
{
ObjectProvider objSM = ec.findObjectProvider(obj);
objSM.setVersion(surrogateVersion);
}
else
{
if (vermd != null && vermd.getFieldName() != null)
{
// Version stored in a normal field
int versionFieldNumber = acmd.getMetaDataForMember(vermd.getFieldName()).getAbsoluteFieldNumber();
if (stmtMapping.getMappingForMemberPosition(versionFieldNumber) != null)
{
ObjectProvider objSM = ec.findObjectProvider(obj);
Object verFieldValue = objSM.provideField(versionFieldNumber);
if (verFieldValue != null)
{
objSM.setVersion(verFieldValue);
}
}
}
}
}