/** * INTERNAL: */ public void setOptimisticLockingPolicy(OptimisticLockingPolicy policy) { m_descriptor.setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy an all fields locking policy. * A field locking policy is base on locking on all fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see AllFieldsLockingPolicy */ public void useAllFieldsLocking() { setOptimisticLockingPolicy(new AllFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy a changed fields locking policy. * A field locking policy is base on locking on all changed fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see ChangedFieldsLockingPolicy */ public void useChangedFieldsLocking() { setOptimisticLockingPolicy(new ChangedFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy an all fields locking policy. * A field locking policy is base on locking on all fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see AllFieldsLockingPolicy */ public void useAllFieldsLocking() { setOptimisticLockingPolicy(new AllFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy an all fields locking policy. * A field locking policy is base on locking on all fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see AllFieldsLockingPolicy */ public void useAllFieldsLocking() { setOptimisticLockingPolicy(new AllFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy a changed fields locking policy. * A field locking policy is base on locking on all changed fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see ChangedFieldsLockingPolicy */ public void useChangedFieldsLocking() { setOptimisticLockingPolicy(new ChangedFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy a changed fields locking policy. * A field locking policy is base on locking on all changed fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see ChangedFieldsLockingPolicy */ public void useChangedFieldsLocking() { setOptimisticLockingPolicy(new ChangedFieldsLockingPolicy()); }
/** * PUBLIC: * Set the locking policy a selected fields locking policy. * A field locking policy is base on locking on the specified fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see SelectedFieldsLockingPolicy */ public void useSelectedFieldsLocking(Vector fieldNames) { SelectedFieldsLockingPolicy policy = new SelectedFieldsLockingPolicy(); policy.setLockFieldNames(fieldNames); setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy a selected fields locking policy. * A field locking policy is base on locking on the specified fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see SelectedFieldsLockingPolicy */ public void useSelectedFieldsLocking(Vector fieldNames) { SelectedFieldsLockingPolicy policy = new SelectedFieldsLockingPolicy(); policy.setLockFieldNames(fieldNames); setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy a selected fields locking policy. * A field locking policy is base on locking on the specified fields by comparing with their previous values to detect field-level collisions. * Note: the unit of work must be used for all updates when using field locking. * @see SelectedFieldsLockingPolicy */ public void useSelectedFieldsLocking(Vector fieldNames) { SelectedFieldsLockingPolicy policy = new SelectedFieldsLockingPolicy(); policy.setLockFieldNames(fieldNames); setOptimisticLockingPolicy(policy); }
/** * Checks class descriptors for {@link @DisableVersioning} annotations at the class level and removes the version * database mapping for optimistic locking. * * @param session the current session. */ protected void handleDisableVersioning(Session session) { Map<Class, ClassDescriptor> descriptors = session.getDescriptors(); if (descriptors == null || descriptors.isEmpty()) { return; } for (ClassDescriptor classDescriptor : descriptors.values()) { if (classDescriptor != null && AnnotationUtils.findAnnotation(classDescriptor.getJavaClass(), DisableVersioning.class) != null) { OptimisticLockingPolicy olPolicy = classDescriptor.getOptimisticLockingPolicy(); if (olPolicy != null) { classDescriptor.setOptimisticLockingPolicy(null); } } } }
/** * PUBLIC: * Set the locking policy to use numeric version locking. * This updates the version field on all updates, first comparing that the field has not changed to detect locking conflicts. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see TimestampLockingPolicy */ public void useVersionLocking(String writeLockFieldName, boolean shouldStoreInCache) { VersionLockingPolicy policy = new VersionLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy to use timestamp version locking. * This updates the timestamp field on all updates, first comparing that the field has not changed to detect locking conflicts. * Note: many database have limited precision of timestamps which can be an issue is highly concurrent systems. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see VersionLockingPolicy */ public void useTimestampLocking(String writeLockFieldName, boolean shouldStoreInCache) { TimestampLockingPolicy policy = new TimestampLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy to use numeric version locking. * This updates the version field on all updates, first comparing that the field has not changed to detect locking conflicts. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see TimestampLockingPolicy */ public void useVersionLocking(String writeLockFieldName, boolean shouldStoreInCache) { VersionLockingPolicy policy = new VersionLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy to use timestamp version locking. * This updates the timestamp field on all updates, first comparing that the field has not changed to detect locking conflicts. * Note: many database have limited precision of timestamps which can be an issue is highly concurrent systems. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see VersionLockingPolicy */ public void useTimestampLocking(String writeLockFieldName, boolean shouldStoreInCache) { TimestampLockingPolicy policy = new TimestampLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy to use numeric version locking. * This updates the version field on all updates, first comparing that the field has not changed to detect locking conflicts. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see TimestampLockingPolicy */ public void useVersionLocking(String writeLockFieldName, boolean shouldStoreInCache) { VersionLockingPolicy policy = new VersionLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * PUBLIC: * Set the locking policy to use timestamp version locking. * This updates the timestamp field on all updates, first comparing that the field has not changed to detect locking conflicts. * Note: many database have limited precision of timestamps which can be an issue is highly concurrent systems. * * The parameter 'shouldStoreInCache' configures the version lock value to be stored in the cache or in the object. * Note: if using a stateless model where the object can be passed to a client and then later updated in a different transaction context, * then the version lock value should not be stored in the cache, but in the object to ensure it is the correct value for that object. * @see VersionLockingPolicy */ public void useTimestampLocking(String writeLockFieldName, boolean shouldStoreInCache) { TimestampLockingPolicy policy = new TimestampLockingPolicy(writeLockFieldName); if (shouldStoreInCache) { policy.storeInCache(); } else { policy.storeInObject(); } setOptimisticLockingPolicy(policy); }
/** * INTERNAL: * Potentially override the optimistic locking behavior */ protected void initializeOptimisticLocking(){ // CR#3214106, do not override if specified in subclass. if (!getDescriptor().usesOptimisticLocking() && getParentDescriptor().usesOptimisticLocking()) { getDescriptor().setOptimisticLockingPolicy((OptimisticLockingPolicy)getParentDescriptor().getOptimisticLockingPolicy().clone()); getDescriptor().getOptimisticLockingPolicy().setDescriptor(getDescriptor()); } }
/** * INTERNAL: * Potentially override the optimistic locking behavior */ protected void initializeOptimisticLocking(){ // CR#3214106, do not override if specified in subclass. if (!getDescriptor().usesOptimisticLocking() && getParentDescriptor().usesOptimisticLocking()) { getDescriptor().setOptimisticLockingPolicy((OptimisticLockingPolicy)getParentDescriptor().getOptimisticLockingPolicy().clone()); getDescriptor().getOptimisticLockingPolicy().setDescriptor(getDescriptor()); } }
/** * INTERNAL: * Potentially override the optimistic locking behavior */ protected void initializeOptimisticLocking(){ // CR#3214106, do not override if specified in subclass. if (!getDescriptor().usesOptimisticLocking() && getParentDescriptor().usesOptimisticLocking()) { getDescriptor().setOptimisticLockingPolicy((OptimisticLockingPolicy)getParentDescriptor().getOptimisticLockingPolicy().clone()); getDescriptor().getOptimisticLockingPolicy().setDescriptor(getDescriptor()); } }