// CR#3173211
// If the value is stored in the cache or object, there still may
// be read-only mappings for it, so the object must always be updated for
// any writable or read-only mappings for the version value.
// Reuse the method used for returning as has the same requirements.
AbstractRecord record = getDescriptor().getObjectBuilder().createRecord(1);
record.put(getWriteLockField(), lockValue);
getDescriptor().getObjectBuilder().assignReturnRow(query.getObject(), query.getSession(), record);
if (query.getSession().isUnitOfWork() && (((UnitOfWorkImpl)query.getSession()).getUnitOfWorkChangeSet() != null)) {
if (objectChangeSet == null) {
// For aggregate collections the change set may be null, as they use the old commit still.
objectChangeSet = (ObjectChangeSet)((UnitOfWorkImpl)query.getSession()).getUnitOfWorkChangeSet().getObjectChangeSetForClone(query.getObject());