Tabnine Logo
OptimisticLockingPolicy.getValueToPutInCache
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: com.haulmont.thirdparty/eclipselink

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

/**
 * 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: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Initialize a cache key.  Called by buildObject and now also by
 * buildWorkingCopyCloneFromRow.
 */
protected void copyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor) {
  //CR #4365 - used to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
    //register the object into the IM and set the write lock object
    cacheKey.setWriteLockValue(cacheValue);
  }
  cacheKey.setReadTime(query.getExecutionTime());
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Initialize a cache key.  Called by buildObject and now also by
 * buildWorkingCopyCloneFromRow.
 */
protected void copyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor) {
  //CR #4365 - used to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
    //register the object into the IM and set the write lock object
    cacheKey.setWriteLockValue(cacheValue);
  }
  cacheKey.setReadTime(query.getExecutionTime());
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Initialize a cache key.  Called by buildObject and now also by
 * buildWorkingCopyCloneFromRow.
 */
protected void copyQueryInfoToCacheKey(CacheKey cacheKey, ObjectBuildingQuery query, AbstractRecord databaseRow, AbstractSession session, ClassDescriptor concreteDescriptor) {
  //CR #4365 - used to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
    //register the object into the IM and set the write lock object
    cacheKey.setWriteLockValue(cacheValue);
  }
  cacheKey.setReadTime(query.getExecutionTime());
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Clean up the cached object data and only revert the fetch group data back to the cached object.
 */
private void revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected) {
  FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor);
  FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager();
  //the cached object is either invalidated, or staled as the version is newer, or a refresh is explicitly set on the query.
  //clean all data of the cache object.
  fetchGroupManager.reset(domainObject);
  //set fetch group reference to the cached object
  fetchGroupManager.setObjectFetchGroup(domainObject, fetchGroupManager.getEntityFetchGroup(fetchGroup), session);
  // Bug 276362 - set the CacheKey's read time (to re-validate the CacheKey) before buildAttributesIntoObject is called
  cacheKey.setReadTime(query.getExecutionTime());
  //read in the fetch group data only
  concreteDescriptor.getObjectBuilder().buildAttributesIntoObject(domainObject, cacheKey, databaseRow, query, joinManager, fetchGroup, false, session);
  //set refresh on fetch group
  fetchGroupManager.setRefreshOnFetchGroupToObject(domainObject, (query.shouldRefreshIdentityMapResult() || concreteDescriptor.shouldAlwaysRefreshCache()));
  //set query id to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  //register the object into the IM and set the write lock object if applied.
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    cacheKey.setWriteLockValue(policy.getValueToPutInCache(databaseRow, session));
  }
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * Clean up the cached object data and only revert the fetch group data back to the cached object.
 */
private void revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected) {
  FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor);
  FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager();
  //the cached object is either invalidated, or staled as the version is newer, or a refresh is explicitly set on the query.
  //clean all data of the cache object.
  fetchGroupManager.reset(domainObject);
  //set fetch group reference to the cached object
  fetchGroupManager.setObjectFetchGroup(domainObject, fetchGroupManager.getEntityFetchGroup(fetchGroup), session);
  // Bug 276362 - set the CacheKey's read time (to re-validate the CacheKey) before buildAttributesIntoObject is called
  cacheKey.setReadTime(query.getExecutionTime());
  //read in the fetch group data only
  concreteDescriptor.getObjectBuilder().buildAttributesIntoObject(domainObject, cacheKey, databaseRow, query, joinManager, fetchGroup, false, session);
  //set refresh on fetch group
  fetchGroupManager.setRefreshOnFetchGroupToObject(domainObject, (query.shouldRefreshIdentityMapResult() || concreteDescriptor.shouldAlwaysRefreshCache()));
  //set query id to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  //register the object into the IM and set the write lock object if applied.
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    cacheKey.setWriteLockValue(policy.getValueToPutInCache(databaseRow, session));
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Clean up the cached object data and only revert the fetch group data back to the cached object.
 */
private void revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session) {
  //the cached object is either invalidated, or staled as the version is newer, or a refresh is explicitly set on the query.
  //clean all data of the cache object.
  concreteDescriptor.getFetchGroupManager().reset(domainObject);
  //set fetch group reference to the cached object
  concreteDescriptor.getFetchGroupManager().setObjectFetchGroup(domainObject, query.getFetchGroup(), session);
  // Bug 276362 - set the CacheKey's read time (to re-validate the CacheKey) before buildAttributesIntoObject is called
  cacheKey.setReadTime(query.getExecutionTime());
  //read in the fetch group data only
  concreteDescriptor.getObjectBuilder().buildAttributesIntoObject(domainObject, databaseRow, query, joinManager, false);
  //set refresh on fetch group
  concreteDescriptor.getFetchGroupManager().setRefreshOnFetchGroupToObject(domainObject, (query.shouldRefreshIdentityMapResult() || concreteDescriptor.shouldAlwaysRefreshCache()));
  //set query id to prevent infinite recursion on refresh object cascade all
  cacheKey.setLastUpdatedQueryId(query.getQueryId());
  //register the object into the IM and set the write lock object if applied.
  if (concreteDescriptor.usesOptimisticLocking()) {
    OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
    cacheKey.setWriteLockValue(policy.getValueToPutInCache(databaseRow, session));
  }
}
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) {
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) {
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

if (concreteDescriptor.usesOptimisticLocking()) {
  OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy();
  Object cacheValue = policy.getValueToPutInCache(databaseRow, session);
  if (concreteDescriptor.shouldOnlyRefreshCacheIfNewerVersion()) {
    refreshRequired = policy.isNewerVersion(databaseRow, domainObject, primaryKey, session);
org.eclipse.persistence.internal.descriptorsOptimisticLockingPolicygetValueToPutInCache

Javadoc

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

Popular methods of OptimisticLockingPolicy

  • 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
  • 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
  • initialize
    INTERNAL: It is responsible for initializing the policy. #see this method in VersionLockingPolicy
  • getWriteLockValue,
  • initialize,
  • initializeProperties,
  • isCascaded,
  • isNewerVersion,
  • isStoredInCache,
  • mergeIntoParentCache,
  • setDescriptor,
  • setupWriteFieldsForInsert

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
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