if (objectChangeSet != null && (!objectChangeSet.isNew() || query.getDescriptor().shouldUseFullChangeSetsForNewObjects())) {
Object oldValue = oldValue = this.lockMapping.getAttributeValueFromObject(object);
this.lockMapping.setAttributeValueInObject(object, convertedLockValue);
objectChangeSet.setWriteLockValue(lockValue);
// Don't use ObjectChangeSet.updateChangeRecordForAttributeWithMappedObject to avoid unnecessary conversion - convertedLockValue is already converted.
DirectToFieldChangeRecord changeRecord = new DirectToFieldChangeRecord(objectChangeSet);
changeRecord.setAttribute(this.lockMapping.getAttributeName());
changeRecord.setMapping(this.lockMapping);
changeRecord.setNewValue(convertedLockValue);
changeRecord.setOldValue(oldValue);
objectChangeSet.addChange(changeRecord);
} else {
this.lockMapping.setAttributeValueInObject(object, convertedLockValue);
}