/** * INTERNAL: * This method adds the lock value to the translation row of the * passed in query. depending on the storage flag, the value is * either retrieved from the cache of the object. */ public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) { Object value; if (isStoredInCache()) { value = query.getSession().getIdentityMapAccessorInstance().getWriteLockValue(query.getPrimaryKey(), query.getObject().getClass(), getDescriptor()); } else { value = lockValueFromObject(query.getObject()); } if (value == null) { if (query.isDeleteObjectQuery()) { throw OptimisticLockException.noVersionNumberWhenDeleting(query.getObject(), query); } else { throw OptimisticLockException.noVersionNumberWhenUpdating(query.getObject(), query); } } query.getTranslationRow().put(this.writeLockField, value); }
/** * INTERNAL: * This method adds the lock value to the translation row of the * passed in query. depending on the storage flag, the value is * either retrieved from the cache of the object. */ public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) { Object value; if (isStoredInCache()) { value = query.getSession().getIdentityMapAccessorInstance().getWriteLockValue(query.getPrimaryKey(), query.getObject().getClass(), getDescriptor()); } else { value = lockValueFromObject(query.getObject()); } if (value == null) { if (query.isDeleteObjectQuery()) { throw OptimisticLockException.noVersionNumberWhenDeleting(query.getObject(), query); } else { throw OptimisticLockException.noVersionNumberWhenUpdating(query.getObject(), query); } } // EL bug 319759 if (query.isUpdateObjectQuery()) { query.setShouldValidateUpdateCallCacheUse(true); } query.getTranslationRow().put(this.writeLockField, value); }
/** * INTERNAL: * This method adds the lock value to the translation row of the * passed in query. depending on the storage flag, the value is * either retrieved from the cache of the object. */ public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) { Object value; if (isStoredInCache()) { value = query.getSession().getIdentityMapAccessorInstance().getWriteLockValue(query.getPrimaryKey(), query.getObject().getClass(), getDescriptor()); } else { value = lockValueFromObject(query.getObject()); } if (value == null) { if (query.isDeleteObjectQuery()) { throw OptimisticLockException.noVersionNumberWhenDeleting(query.getObject(), query); } else { throw OptimisticLockException.noVersionNumberWhenUpdating(query.getObject(), query); } } // EL bug 319759 if (query.isUpdateObjectQuery()) { query.setShouldValidateUpdateCallCacheUse(true); } query.getTranslationRow().put(this.writeLockField, value); }