Codota Logo
OptimisticLockingPolicy
Code IndexAdd Codota to your IDE (free)

How to use
OptimisticLockingPolicy
in
org.eclipse.persistence.internal.descriptors

Best Java code snippets using org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy (Showing top 20 results out of 315)

  • Common ways to obtain OptimisticLockingPolicy
private void myMethod () {
OptimisticLockingPolicy o =
  • Codota IconClassDescriptor descriptor;descriptor.getOptimisticLockingPolicy()
  • Codota IconUnidirectionalOneToManyMapping unidirectionalOneToManyMapping;unidirectionalOneToManyMapping.getReferenceDescriptor().getOptimisticLockingPolicy()
  • Codota IconExpressionQueryMechanism expressionQueryMechanism;expressionQueryMechanism.getDescriptor().getOptimisticLockingPolicy()
  • Smart code suggestions by Codota
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Build the row representation of the object for update. The row built does not
 * contain entries for uninstantiated attributes.
 */
public AbstractRecord buildTemplateUpdateRow(AbstractSession session) {
  AbstractRecord databaseRow = createRecord(session);
  for (Iterator mappings = getNonPrimaryKeyMappings().iterator();
       mappings.hasNext();) {
    DatabaseMapping mapping = (DatabaseMapping)mappings.next();
    mapping.writeUpdateFieldsIntoRow(databaseRow, session);
  }
  if (this.descriptor.usesOptimisticLocking()) {
    this.descriptor.getOptimisticLockingPolicy().addLockFieldsToUpdateRow(databaseRow, session);
  }
  return databaseRow;
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Build and return the expression to use as the where clause to delete an object.
 * The row is passed to allow the version number to be extracted from it.
 * If called with usesOptimisticLocking==true the caller should make sure that descriptor uses optimistic locking policy.
 */
public Expression buildDeleteExpression(DatabaseTable table, AbstractRecord row, boolean usesOptimisticLocking) {
  if (usesOptimisticLocking && (this.descriptor.getTables().firstElement().equals(table))) {
    return this.descriptor.getOptimisticLockingPolicy().buildDeleteExpression(table, primaryKeyExpression, row);
  } else {
    return buildPrimaryKeyExpression(table);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Build and return the expression to use as the where clause to an update object.
 * The row is passed to allow the version number to be extracted from it.
 */
public Expression buildUpdateExpression(DatabaseTable table, AbstractRecord transactionRow, AbstractRecord modifyRow) {
  // Only the first table must use the lock check.
  Expression primaryKeyExpression = buildPrimaryKeyExpression(table);
  if (this.descriptor.usesOptimisticLocking()) {
    return this.descriptor.getOptimisticLockingPolicy().buildUpdateExpression(table, primaryKeyExpression, transactionRow, modifyRow);
  } else {
    return primaryKeyExpression;
  }
}
origin: com.haulmont.thirdparty/eclipselink

Object originalWriteLockValue = optimisticLockingPolicy.getWriteLockValue(original, getId(), session);
if (originalWriteLockValue != null && optimisticLockingPolicy.compareWriteLockValues(initialWriteLockValue, originalWriteLockValue) != 0) {    
  return true;
} else {
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * 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());
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

lockingPolicy.addLockValuesToTranslationRow(writeQuery);
  lockingPolicy.updateRowAndObjectForUpdate(writeQuery, object);
} else if (!shouldModifyVersionField.booleanValue() && (lockingPolicy instanceof VersionLockingPolicy)) {
lockingPolicy.validateUpdate(rowCount, object, writeQuery);
origin: org.eclipse.persistence/org.eclipse.persistence.core

if (concreteDescriptor.usesOptimisticLocking()) {
  OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
  Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
  if (concreteDescriptor.getCachePolicy().shouldOnlyRefreshCacheIfNewerVersion()) {
    if (cacheValue == null) {
      refreshRequired = policy.isNewerVersion(databaseRow, domainObject, cacheKey.getKey(), session);
    } else {
      refreshRequired = policy.isNewerVersion(cacheValue, domainObject, cacheKey.getKey(), session);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

int difference = descriptor.getOptimisticLockingPolicy().getVersionDifference(changeSet.getInitialWriteLockValue(), original, changeSet.getPrimaryKeys(), session);
  if (descriptor.usesOptimisticLocking() && descriptor.getOptimisticLockingPolicy().isStoredInCache()) {
    cacheKey.setWriteLockValue(changeSet.getWriteLockValue());
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

if(policy.getWriteLockField() != null) {
  Expression writeLock = builder.getField(policy.getWriteLockField());
  Expression writeLockUpdateExpression = policy.getWriteLockUpdateExpression(builder, getQuery().getSession());
  if (writeLockUpdateExpression != null) {
origin: org.eclipse.persistence/org.eclipse.persistence.core

DatabaseField lockField = getDescriptor().getOptimisticLockingPolicy().getWriteLockField();
if (lockField != null) {
  fetchedFields.add(lockField);
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Store the query object in the identity map.
 */
protected void registerObjectInIdentityMap(Object object, ClassDescriptor descriptor, AbstractSession session) {
  WriteObjectQuery query = getWriteObjectQuery();
  if (query.shouldMaintainCache()) {
    if (descriptor.usesOptimisticLocking()) {
      Object optimisticLockValue = descriptor.getOptimisticLockingPolicy().getValueToPutInCache(query.getModifyRow(), session);
      session.getIdentityMapAccessorInstance().putInIdentityMap(object, query.getPrimaryKey(), optimisticLockValue, System.currentTimeMillis(), descriptor);
    } else {
      session.getIdentityMapAccessorInstance().putInIdentityMap(object, query.getPrimaryKey(), null, System.currentTimeMillis(), descriptor);
    }
  }
}
origin: com.haulmont.thirdparty/eclipselink

  objectDescriptor.setWriteLockValue(null);
}else{
  objectDescriptor.setWriteLockValue(policy.getBaseValue());
  objectDescriptor.setWriteLockValue(null);
}else{
  objectDescriptor.setWriteLockValue(policy.getBaseValue());
origin: org.eclipse.persistence/org.eclipse.persistence.core

  /**
   * INTERNAL:
   * Prepare the receiver for execution in a session. In particular,
   * verify that the object is not null and contains a valid primary key.
   */
  public void prepareForExecution() throws QueryException {
    super.prepareForExecution();

    // Set the translation row
    if ((this.translationRow == null) || this.translationRow.isEmpty()) {
      if (this.isFullRowRequired) {
        this.translationRow = this.descriptor.getObjectBuilder().buildRow(this.object, this.session, WriteType.UNDEFINED);
      } else {
        this.translationRow = this.descriptor.getObjectBuilder().buildRowForTranslation(this.object, this.session);
      }
    }

    // Add the write lock field if required
    if (this.usesOptimisticLocking) {
      this.descriptor.getOptimisticLockingPolicy().addLockValuesToTranslationRow(this);
    }
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

if(this.optimisticLockingPolicy.compareWriteLockValues(writeLockValueToCompare, changeSetToMergeFrom.initialWriteLockValue) != 0) {
  this.isInvalid = true;
  return;
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

clonedDescriptor.setOptimisticLockingPolicy((OptimisticLockingPolicy)getOptimisticLockingPolicy().clone());
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

policy.addLockValuesToTranslationRow(writeQuery);
  policy.updateRowAndObjectForUpdate(writeQuery, object);
} else if (!shouldModifyVersionField.booleanValue() && (policy instanceof VersionLockingPolicy)) {
descriptor.getOptimisticLockingPolicy().validateUpdate(rowCount, object, writeQuery);
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * 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());
  }
}
 
origin: org.eclipse.persistence/org.eclipse.persistence.core

Object originalWriteLockValue = optimisticLockingPolicy.getWriteLockValue(original, getId(), session);
if (originalWriteLockValue != null && optimisticLockingPolicy.compareWriteLockValues(initialWriteLockValue, originalWriteLockValue) != 0) {
  return true;
} else {
origin: com.haulmont.thirdparty/eclipselink

if (concreteDescriptor.usesOptimisticLocking()) {
  OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
  Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
  if (concreteDescriptor.getCachePolicy().shouldOnlyRefreshCacheIfNewerVersion()) {
    if (cacheValue == null) {
      refreshRequired = policy.isNewerVersion(databaseRow, domainObject, cacheKey.getKey(), session);
    } else {
      refreshRequired = policy.isNewerVersion(cacheValue, domainObject, cacheKey.getKey(), session);
origin: com.haulmont.thirdparty/eclipselink

int difference = descriptor.getOptimisticLockingPolicy().getVersionDifference(changeSet.getInitialWriteLockValue(), original, changeSet.getId(), session);
if (descriptor.usesOptimisticLocking() && descriptor.getOptimisticLockingPolicy().isStoredInCache()) {
  cacheKey.setWriteLockValue(changeSet.getWriteLockValue());
org.eclipse.persistence.internal.descriptorsOptimisticLockingPolicy

Most used methods

  • addLockFieldsToUpdateRow
    INTERNAL: Add update fields for template row. These are any unmapped fields required to write in an
  • addLockValuesToTranslationRow
    INTERNAL: The method should update the translation row with the correct write lock values. This meth
  • buildDeleteExpression
    INTERNAL: When given an expression, this method will return a new expression with the optimistic loc
  • buildUpdateExpression
    INTERNAL: When given an expression, this method will return a new expression with the optimistic loc
  • clone
  • compareWriteLockValues
    INTERNAL: This method shouldn't be called if supportsWriteLockValuesComparison() returns false. This
  • getBaseValue
    INTERNAL: This is the base value that is older than all other values, it is used in the place of nul
  • getValueToPutInCache
    INTERNAL: Return the value that should be stored in the identity map. If the value is not stored in
  • getVersionDifference
    PUBLIC: Return the number of versions different between these objects.
  • getWriteLockField
    INTERNAL: Return the write lock field. #see this method in VersionLockingPolicy
  • getWriteLockUpdateExpression
    INTERNAL: This method will return an expression that is used to update its optimistic locking field
  • getWriteLockValue
    INTERNAL: This method will return the optimistic lock value for the object #see this method in Versi
  • getWriteLockUpdateExpression,
  • getWriteLockValue,
  • initialize,
  • initializeProperties,
  • isCascaded,
  • isNewerVersion,
  • isStoredInCache,
  • mergeIntoParentCache,
  • setDescriptor,
  • setupWriteFieldsForInsert

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • setContentView (Activity)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now