Tabnine Logo
TimestampLockingPolicy.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.eclipse.persistence.descriptors.TimestampLockingPolicy
constructor

Best Java code snippets using org.eclipse.persistence.descriptors.TimestampLockingPolicy.<init> (Showing top 4 results out of 315)

origin: org.eclipse.persistence/org.eclipse.persistence.core

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

/**
 * 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);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * 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);
}
origin: com.haulmont.thirdparty/eclipselink

  /**
   * INTERNAL:
   * Process a version accessor.
   */
  @Override
  public void process() {
    // This will initialize the m_field variable. Accessible through getField().
    super.process();
    
    // Process an @Version or version element if there is one.
    if (getDescriptor().usesOptimisticLocking()) {
      // Ignore the version locking if it is already set.
      getLogger().logConfigMessage(MetadataLogger.IGNORE_VERSION_LOCKING, this);
    } else {
      MetadataClass lockType = getRawClass();
      getDatabaseField().setTypeName(getJavaClassName(lockType));

      if (isValidVersionLockingType(lockType) || isValidTimestampVersionLockingType(lockType)) {
        for (MetadataDescriptor owningDescriptor : getOwningDescriptors()) {
          VersionLockingPolicy policy = isValidVersionLockingType(lockType) ? new VersionLockingPolicy(getDatabaseField()) : new TimestampLockingPolicy(getDatabaseField());  
          policy.storeInObject();
          policy.setIsCascaded(getDescriptor().usesCascadedOptimisticLocking());
          owningDescriptor.setOptimisticLockingPolicy(policy);
        }
      } else {
        throw ValidationException.invalidTypeForVersionAttribute(getAttributeName(), lockType, getJavaClass());
      }
    }
  }
}
org.eclipse.persistence.descriptorsTimestampLockingPolicy<init>

Javadoc

PUBLIC: Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server.

Popular methods of TimestampLockingPolicy

  • getDescriptor
  • getInitialWriteValue
    INTERNAL: returns the initial locking value
  • getWriteLockField
  • isNewerVersion
    INTERNAL: Compares the value from the row and from the object (or cache). Will return true if the ro
  • isStoredInCache
  • lockValueFromObject
  • storeInCache
  • storeInObject
  • useLocalTime
    PUBLIC: set this policy to get the time from the local machine.
  • useServerTime
    PUBLIC: set this policy to get the time from the server.
  • usesLocalTime
    PUBLIC: Return true if policy uses local time.
  • usesServerTime
    PUBLIC: Return true if policy uses server time.
  • usesLocalTime,
  • usesServerTime

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ImageIO (javax.imageio)
  • JTextField (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now