| Modifier and Type | Class and Description |
|---|---|
| public static enum | OptimisticLockingPolicy.LockOnChange
Advanced: Purpose: Provides the configuration options to force an Optimistic Write Lock When a set of mappings have changes. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLockFieldsToUpdateRow(AbstractRecord databaseRow, AbstractSession session)
INTERNAL: Add update fields for template row. |
| public void | addLockValuesToTranslationRow(ObjectLevelModifyQuery query)
INTERNAL: The method should update the translation row with the correct write lock values. |
| public Expression | buildDeleteExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row)
INTERNAL: When given an expression, this method will return a new expression with the optimistic locking values included. |
| public Expression | buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord translationRow, AbstractRecord modifyRow)
INTERNAL: When given an expression, this method will return a new expression with the optimistic locking values included. |
| public Object | |
| public int | compareWriteLockValues(Object value1, Object value2)
INTERNAL: This method shouldn't be called if supportsWriteLockValuesComparison() returns false. |
| public <T> T | getBaseValue()
INTERNAL: This is the base value that is older than all other values, it is used in the place of null in some situations. |
| public OptimisticLockingPolicy. | |
| public <T> T | getValueToPutInCache(AbstractRecord row, AbstractSession session)
INTERNAL: Return the value that should be stored in the identity map. |
| public int | getVersionDifference(Object currentValue, Object domainObject, Object primaryKey, AbstractSession session)
PUBLIC: Return the number of versions different between these objects. |
| public DatabaseField | |
| public Expression | getWriteLockUpdateExpression(ExpressionBuilder builder, AbstractSession session)
INTERNAL: This method will return an expression that is used to update its optimistic locking field #see this method in VersionLockingPolicy |
| public <T> T | getWriteLockValue(Object domainObject, Object primaryKey, AbstractSession session)
INTERNAL: This method will return the optimistic lock value for the object #see this method in VersionLockingPolicy |
| public void | |
| public void | |
| public boolean | |
| public boolean | isNewerVersion(Object currentValue, Object domainObject, Object primaryKey, AbstractSession session)
INTERNAL: Returns true if the value stored with the domainObject is more recent than the value . |
| public boolean | isNewerVersion(AbstractRecord databaseRow, Object domainObject, Object primaryKey, AbstractSession session)
INTERNAL: Returns true if the value stored with the domainObject is more recent than the value in the row. |
| public boolean | |
| public void | mergeIntoParentCache(UnitOfWorkImpl uow, Object primaryKey, Object object)
INTERNAL: This method should merge changes from the parent into the child. |
| public void | mergeIntoParentCache(CacheKey unitOfWorkCacheKey, CacheKey parentSessionCacheKey)
INTERNAL: This method should merge changes from the parent into the child. |
| public void | setDescriptor(ClassDescriptor descriptor)
INTERNAL: provide a way to set the descriptor for this policy |
| public void | setLockOnChangeMode(OptimisticLockingPolicy.
ADVANCED: Sets the LockOnChange mode for this policy. |
| public void | setupWriteFieldsForInsert(ObjectLevelModifyQuery query)
INTERNAL: Add the initial right lock values to the modify row in the query. |
| public boolean | shouldUpdateVersionOnMappingChange()
INTERNAL: Returns true if the policy has been set to set an optimistic read lock when any mapping changes. |
| public boolean | shouldUpdateVersionOnOwnedMappingChange()
INTERNAL: Returns true if the policy has been set to set an optimistic read lock when a owning mapping changes. |
| public boolean | supportsWriteLockValuesComparison()
INTERNAL: Indicates whether compareWriteLockValues method is supported by the policy. |
| public void | updateRowAndObjectForUpdate(ObjectLevelModifyQuery query, Object object)
INTERNAL: This method should update the translation row, the modify row and the domain object with th lock value. |
| public void | |
| public void |
| addLockFieldsToUpdateRow | back to summary |
|---|---|
| public void addLockFieldsToUpdateRow(AbstractRecord databaseRow, AbstractSession session) INTERNAL: Add update fields for template row. These are any unmapped fields required to write in an update. #see this method in VersionLockingPolicy | |
| addLockValuesToTranslationRow | back to summary |
|---|---|
| public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) INTERNAL: The method should update the translation row with the correct write lock values. This method is called on a delete. #see this method in VersionLockingPolicy | |
| buildDeleteExpression | back to summary |
|---|---|
| public Expression buildDeleteExpression(DatabaseTable table, Expression mainExpression, AbstractRecord row) INTERNAL: When given an expression, this method will return a new expression with the optimistic locking values included. This expression will be used in a delete call. #see this method in VersionLockingPolicy | |
| buildUpdateExpression | back to summary |
|---|---|
| public Expression buildUpdateExpression(DatabaseTable table, Expression mainExpression, AbstractRecord translationRow, AbstractRecord modifyRow) INTERNAL: When given an expression, this method will return a new expression with the optimistic locking values included. This expression will be used in an update call. #see this method in VersionLockingPolicy | |
| clone | back to summary |
|---|---|
| public Object clone() | |
| compareWriteLockValues | back to summary |
|---|---|
| public int compareWriteLockValues(Object value1, Object value2) INTERNAL: This method shouldn't be called if supportsWriteLockValuesComparison() returns false. This method compares two writeLockValues. The writeLockValues should be non-null and of the correct type. Returns: -1 if value1 is less (older) than value2; 0 if value1 equals value2; 1 if value1 is greater (newer) than value2. Throws: NullPointerException if the passed value is null; ClassCastException if the passed value is of a wrong type. | |
| getBaseValue | back to summary |
|---|---|
| public <T> T getBaseValue() INTERNAL: This is the base value that is older than all other values, it is used in the place of null in some situations. | |
| getLockOnChangeMode | back to summary |
|---|---|
| public OptimisticLockingPolicy. ADVANCED: returns the LockOnChange mode for this policy. This mode specifies if a Optimistic Write lock should be enforced on this entity when a set of mappings are changed. | |
| getValueToPutInCache | back to summary |
|---|---|
| public <T> T getValueToPutInCache(AbstractRecord row, AbstractSession session) INTERNAL: Return the value that should be stored in the identity map. If the value is not stored in the cache, then return a null. #see this method in VersionLockingPolicy | |
| getVersionDifference | back to summary |
|---|---|
| public int getVersionDifference(Object currentValue, Object domainObject, Object primaryKey, AbstractSession session) PUBLIC: Return the number of versions different between these objects. | |
| getWriteLockField | back to summary |
|---|---|
| public DatabaseField getWriteLockField() INTERNAL: Return the write lock field. #see this method in VersionLockingPolicy | |
| getWriteLockUpdateExpression | back to summary |
|---|---|
| public Expression getWriteLockUpdateExpression(ExpressionBuilder builder, AbstractSession session) INTERNAL: This method will return an expression that is used to update its optimistic locking field #see this method in VersionLockingPolicy | |
| getWriteLockValue | back to summary |
|---|---|
| public <T> T getWriteLockValue(Object domainObject, Object primaryKey, AbstractSession session) INTERNAL: This method will return the optimistic lock value for the object #see this method in VersionLockingPolicy | |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) INTERNAL: It is responsible for initializing the policy. #see this method in VersionLockingPolicy | |
| initializeProperties | back to summary |
|---|---|
| public void initializeProperties() INTERNAL: Responsible for pre-initializing. #see this method in VersionLockingPolicy | |
| isCascaded | back to summary |
|---|---|
| public boolean isCascaded() INTERNAL: Specify if the policy cascade locks. | |
| isNewerVersion | back to summary |
|---|---|
| public boolean isNewerVersion(Object currentValue, Object domainObject, Object primaryKey, AbstractSession session) INTERNAL: Returns true if the value stored with the domainObject is more recent than the value . Returns false otherwise. #see this method in VersionLockingPolicy | |
| isNewerVersion | back to summary |
|---|---|
| public boolean isNewerVersion(AbstractRecord databaseRow, Object domainObject, Object primaryKey, AbstractSession session) INTERNAL: Returns true if the value stored with the domainObject is more recent than the value in the row. Returns false otherwise. Note This method will only be called if the shouldOnlyRefreshCacheIfNewerVersion() flag is set on descriptor. #see this method in VersionLockingPolicy | |
| isStoredInCache | back to summary |
|---|---|
| public boolean isStoredInCache() INTERNAL: Return true if the lock value is stored in the cache. | |
| mergeIntoParentCache | back to summary |
|---|---|
| public void mergeIntoParentCache(UnitOfWorkImpl uow, Object primaryKey, Object object) INTERNAL: This method should merge changes from the parent into the child. #see this method in VersionLockingPolicy | |
| mergeIntoParentCache | back to summary |
|---|---|
| public void mergeIntoParentCache(CacheKey unitOfWorkCacheKey, CacheKey parentSessionCacheKey) INTERNAL: This method should merge changes from the parent into the child. #see this method in VersionLockingPolicy | |
| setDescriptor | back to summary |
|---|---|
| public void setDescriptor(ClassDescriptor descriptor) INTERNAL: provide a way to set the descriptor for this policy | |
| setLockOnChangeMode | back to summary |
|---|---|
| public void setLockOnChangeMode(OptimisticLockingPolicy. ADVANCED: Sets the LockOnChange mode for this policy. This mode specifies if a Optimistic Write lock should be enforced on this entity when set of mappings are changed. | |
| setupWriteFieldsForInsert | back to summary |
|---|---|
| public void setupWriteFieldsForInsert(ObjectLevelModifyQuery query) INTERNAL: Add the initial right lock values to the modify row in the query. This method will only be called on insert. #see this method in VersionLockingPolicy | |
| shouldUpdateVersionOnMappingChange | back to summary |
|---|---|
| public boolean shouldUpdateVersionOnMappingChange() INTERNAL: Returns true if the policy has been set to set an optimistic read lock when any mapping changes. | |
| shouldUpdateVersionOnOwnedMappingChange | back to summary |
|---|---|
| public boolean shouldUpdateVersionOnOwnedMappingChange() INTERNAL: Returns true if the policy has been set to set an optimistic read lock when a owning mapping changes. | |
| supportsWriteLockValuesComparison | back to summary |
|---|---|
| public boolean supportsWriteLockValuesComparison() INTERNAL: Indicates whether compareWriteLockValues method is supported by the policy. Numeric or timestamp lock values could be compared: for every pair of values v1 and v2 - either v1 lessthan v2; or v1==v2; or v1 greaterthan v2. However it's impossible to compare values for FieldsLockingPolicy for two reasons: 1. there is no "linear order": v1 lessthan v2 and v greaterthan v2 is not defined: either v1==v2 or v1!=v2; 2. locking value is not a single field which is not part of mapped object value but rather a set of object's mapped fields. That means any object's mapped attribute change is potentially a change of the locking value. For ChangedFieldsLockingPolicy every mapped attribute's change is a change of locking value. The pattern used by versioning: "if the original locking value is unchanged then the object hasn't been changed outside of the application", which allows to distinguish between the change made inside and outside the application, doesn't work for fields locking. It degenerates into useless pattern: "if the original locking value is unchanged then the object hasn't been changed". Use compareWriteLockValues method only if this method returns true. | |
| updateRowAndObjectForUpdate | back to summary |
|---|---|
| public void updateRowAndObjectForUpdate(ObjectLevelModifyQuery query, Object object) INTERNAL: This method should update the translation row, the modify row and the domain object with th lock value. #see this method in VersionLockingPolicy | |
| validateDelete | back to summary |
|---|---|
| public void validateDelete(int rowCount, Object object, DeleteObjectQuery query) | |
| validateUpdate | back to summary |
|---|---|
| public void validateUpdate(int rowCount, Object object, WriteObjectQuery query) | |
Purpose: Provides the configuration options to force an Optimistic Write Lock When a set of mappings have changes. This enum defines what mappings are within that set.
| Modifier and Type | Field and Description |
|---|---|
| public static final OptimisticLockingPolicy. | |
| public static final OptimisticLockingPolicy. | |
| public static final OptimisticLockingPolicy. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static OptimisticLockingPolicy. | |
| public static OptimisticLockingPolicy. |
| ALL | back to summary |
|---|---|
| public static final OptimisticLockingPolicy. | |
| NONE | back to summary |
|---|---|
| public static final OptimisticLockingPolicy. | |
| OWNING | back to summary |
|---|---|
| public static final OptimisticLockingPolicy. | |
| LockOnChange | back to summary |
|---|---|
| private LockOnChange() | |
| valueOf | back to summary |
|---|---|
| public static OptimisticLockingPolicy. | |
| values | back to summary |
|---|---|
| public static OptimisticLockingPolicy. | |