/** * PUBLIC: * Return the field name of the field that stores the write lock value. */ public String getWriteLockFieldName() { return getWriteLockField().getQualifiedName(); }
/** * PUBLIC: * Return the field name of the field that stores the write lock value. */ public String getWriteLockFieldName() { return getWriteLockField().getQualifiedName(); }
/** * PUBLIC: * Return the field name of the field that stores the write lock value. */ public String getWriteLockFieldName() { return getWriteLockField().getQualifiedName(); }
/** * INTERNAL: * This method returns any of the fields that are not mapped in * the object. In the case of the value being stored in the * cache, a vector with one value is returned. In the case * of being stored in the object, an empty vector is returned. */ protected Vector getUnmappedFields() { Vector fields = new Vector(1); if (isStoredInCache()) { fields.addElement(getWriteLockField()); } return fields; }
/** * INTERNAL: * This method returns any of the fields that are not mapped in * the object. In the case of the value being stored in the * cache, a vector with one value is returned. In the case * of being stored in the object, an empty vector is returned. */ protected Vector getUnmappedFields() { Vector fields = new Vector(1); if (isStoredInCache()) { fields.addElement(getWriteLockField()); } return fields; }
/** * INTERNAL: * This method returns any of the fields that are not mapped in * the object. In the case of the value being stored in the * cache, a vector with one value is returned. In the case * of being stored in the object, an empty vector is returned. */ protected Vector getUnmappedFields() { Vector fields = new Vector(1); if (isStoredInCache()) { fields.addElement(getWriteLockField()); } return fields; }
/** * INTERNAL: * Return the value that should be stored in the identity map. * If the value is stored in the object, then return a null. */ public Object getValueToPutInCache(AbstractRecord row, AbstractSession session) { if (isStoredInCache()) { return row.get(getWriteLockField()); } else { return null; } }
/** * INTERNAL: * Return the value that should be stored in the identity map. * If the value is stored in the object, then return a null. */ public Object getValueToPutInCache(AbstractRecord row, AbstractSession session) { if (isStoredInCache()) { return row.get(getWriteLockField()); } else { return null; } }
/** * INTERNAL: * Add update fields for template row. * These are any unmapped fields required to write in an update. */ public void addLockFieldsToUpdateRow(AbstractRecord databaseRow, AbstractSession session) { if (isStoredInCache()) { databaseRow.put(getWriteLockField(), null); } }
/** * INTERNAL: * Add update fields for template row. * These are any unmapped fields required to write in an update. */ public void addLockFieldsToUpdateRow(AbstractRecord databaseRow, AbstractSession session) { if (isStoredInCache()) { databaseRow.put(getWriteLockField(), null); } }
/** * INTERNAL: * Return the value that should be stored in the identity map. * If the value is stored in the object, then return a null. */ public Object getValueToPutInCache(AbstractRecord row, AbstractSession session) { if (isStoredInCache()) { return row.get(getWriteLockField()); } else { return null; } }
/** * INTERNAL: * Returns an expression that will be used for both the update and * delete where clause */ protected Expression buildExpression() { ExpressionBuilder builder = new ExpressionBuilder(); return builder.getField(getWriteLockField()).equal(builder.getParameter(getWriteLockField())); }
/** * INTERNAL: * Add update fields for template row. * These are any unmapped fields required to write in an update. */ public void addLockFieldsToUpdateRow(AbstractRecord databaseRow, AbstractSession session) { if (isStoredInCache()) { databaseRow.put(getWriteLockField(), null); } }
/** * INTERNAL: * Returns an expression that will be used for both the update and * delete where clause */ protected Expression buildExpression() { ExpressionBuilder builder = new ExpressionBuilder(); return builder.getField(getWriteLockField()).equal(builder.getParameter(getWriteLockField())); }
/** * INTERNAL: * Returns an expression that will be used for both the update and * delete where clause */ protected Expression buildExpression() { ExpressionBuilder builder = new ExpressionBuilder(); return builder.getField(getWriteLockField()).equal(builder.getParameter(getWriteLockField())); }
/** * INTERNAL: * When given an expression, this method will return a new expression * with the optimistic locking values included. The values are taken * from the passed in database row. This expression will be used in * an update call. */ public Expression buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row, AbstractRecord row2) { if (cachedExpression == null) { cachedExpression = buildExpression(); } if (getWriteLockField().getTableName().equals(table.getName())) { return mainExpression.and(cachedExpression); } return mainExpression; }
/** * INTERNAL: * When given an expression, this method will return a new expression * with the optimistic locking values included. The values are taken * from the passed in database row. This expression will be used in * an update call. */ public Expression buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row, AbstractRecord row2) { if (cachedExpression == null) { cachedExpression = buildExpression(); } if (getWriteLockField().getTableName().equals(table.getName())) { return mainExpression.and(cachedExpression); } return mainExpression; }
/** * INTERNAL: * Compares the value from the row and from the object (or cache). * Will return true if the row is newer than the object. */ public boolean isNewerVersion(AbstractRecord databaseRow, Object domainObject, java.util.Vector primaryKey, AbstractSession session) { Number writeLockFieldValue; Number newWriteLockFieldValue = (Number)databaseRow.get(getWriteLockField()); if (isStoredInCache()) { writeLockFieldValue = (Number)session.getIdentityMapAccessorInstance().getWriteLockValue(primaryKey, domainObject.getClass(), getDescriptor()); } else { writeLockFieldValue = (Number)lockValueFromObject(domainObject); } return isNewerVersion(newWriteLockFieldValue, writeLockFieldValue); }
/** * INTERNAL: * Compares the value from the row and from the object (or cache). * Will return true if the row is newer than the object. */ public boolean isNewerVersion(AbstractRecord databaseRow, Object domainObject, Object primaryKey, AbstractSession session) { Number writeLockFieldValue; Number newWriteLockFieldValue = (Number)databaseRow.get(getWriteLockField()); if (isStoredInCache()) { writeLockFieldValue = (Number)session.getIdentityMapAccessorInstance().getWriteLockValue(primaryKey, domainObject.getClass(), getDescriptor()); } else { writeLockFieldValue = (Number)lockValueFromObject(domainObject); } return isNewerVersion(newWriteLockFieldValue, writeLockFieldValue); }
/** * INTERNAL: * Compares the value from the row and from the object (or cache). * Will return true if the row is newer than the object. */ public boolean isNewerVersion(AbstractRecord databaseRow, Object domainObject, Object primaryKey, AbstractSession session) { Number writeLockFieldValue; Number newWriteLockFieldValue = (Number)databaseRow.get(getWriteLockField()); if (isStoredInCache()) { writeLockFieldValue = (Number)session.getIdentityMapAccessorInstance().getWriteLockValue(primaryKey, domainObject.getClass(), getDescriptor()); } else { writeLockFieldValue = (Number)lockValueFromObject(domainObject); } return isNewerVersion(newWriteLockFieldValue, writeLockFieldValue); }