Tabnine Logo
EntityRegionAccessStrategy
Code IndexAdd Tabnine to your IDE (free)

How to use
EntityRegionAccessStrategy
in
org.hibernate.cache.spi.access

Best Java code snippets using org.hibernate.cache.spi.access.EntityRegionAccessStrategy (Showing top 20 results out of 315)

origin: debop/hibernate-redis

 public static String getRegionName(SessionFactory sessionFactory,
                   Class entityClass) {
  EntityPersister p = ((SessionFactoryImpl) sessionFactory).getEntityPersister(entityClass.getName());

  if (p.hasCache()) {
   return p.getCacheAccessStrategy().getRegion().getName();
  }
  return "";
 }
}
origin: org.infinispan/infinispan-hibernate-cache-v51

@Override
public boolean afterInsert(Object session, Object key, Object value, Object version) throws CacheException {
  return unwrapEntity().afterInsert(unwrap(session), key, value, version);
}
origin: org.infinispan/infinispan-hibernate-cache-v51

@Override
public boolean afterUpdate(Object session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
  return unwrapEntity().afterUpdate(unwrap(session), key, value, currentVersion, previousVersion, lock);
}
origin: org.hibernate/com.springsource.org.hibernate

    persister.getRootEntityName()
);
lock = persister.getCacheAccessStrategy().lockItem( ck, previousVersion );
  persister.getCacheAccessStrategy().remove( ck );
  );
  cacheEntry = persister.getCacheEntryStructure().structure( ce );
  boolean put = persister.getCacheAccessStrategy().update( ck, cacheEntry, nextVersion, previousVersion );
  if ( put && factory.getStatistics().isStatisticsEnabled() ) {
    factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws CacheException {
  EntityPersister persister = getPersister();
  if ( persister.hasCache() ) {
    
    final CacheKey ck = getSession().generateCacheKey(
        getId(), 
        persister.getIdentifierType(), 
        persister.getRootEntityName()
      );
    
    if ( success && cacheEntry!=null /*!persister.isCacheInvalidationRequired()*/ ) {
      boolean put = persister.getCacheAccessStrategy().afterUpdate( ck, cacheEntry, nextVersion, previousVersion, lock );
      
      if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
        getSession().getFactory().getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
      }
    }
    else {
      persister.getCacheAccessStrategy().unlockItem( ck, lock );
    }
  }
  postCommitUpdate();
}
origin: org.hibernate/com.springsource.org.hibernate

persister.getCacheAccessStrategy().update(
    cacheKey,
    persister.getCacheEntryStructure().structure( entry ),
boolean put = persister.getCacheAccessStrategy().putFromLoad(
    cacheKey,
    persister.getCacheEntryStructure().structure( entry ),
  factory.getStatisticsImplementor().secondLevelCachePut( persister.getCacheAccessStrategy().getRegion().getName() );
origin: org.hibernate/com.springsource.org.hibernate

@Override
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws HibernateException {
  EntityPersister persister = getPersister();
  if ( success && isCachePutEnabled( persister, getSession() ) ) {
    final CacheKey ck = getSession().generateCacheKey( getId(), persister.getIdentifierType(), persister.getRootEntityName() );
    boolean put = persister.getCacheAccessStrategy().afterInsert( ck, cacheEntry, version );
    
    if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
      getSession().getFactory().getStatisticsImplementor()
          .secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
    }
  }
  postCommitInsert();
}
origin: org.hibernate/com.springsource.org.hibernate

boolean put = persister.getCacheAccessStrategy().insert( ck, cacheEntry, version );
  factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
origin: org.hibernate/com.springsource.org.hibernate

    persister.getRootEntityName()
);
Object ce = persister.getCacheAccessStrategy().get( ck, source.getTimestamp() );
if ( factory.getStatistics().isStatisticsEnabled() ) {
  if ( ce == null ) {
    factory.getStatisticsImplementor().secondLevelCacheMiss(
        persister.getCacheAccessStrategy().getRegion().getName()
    );
        persister.getCacheAccessStrategy().getRegion().getName()
    );
origin: org.hibernate/com.springsource.org.hibernate

    persister.getRootEntityName()
);
lock = persister.getCacheAccessStrategy().lockItem( ck, null );
  persister.getCacheAccessStrategy().unlockItem( ck, lock );
origin: org.hibernate/com.springsource.org.hibernate

if ( persister.hasCache() ) {
  ck = session.generateCacheKey( id, persister.getIdentifierType(), persister.getRootEntityName() );
  lock = persister.getCacheAccessStrategy().lockItem( ck, version );
  persister.getCacheAccessStrategy().remove( ck );
origin: org.hibernate/com.springsource.org.hibernate.core

public void evictEntity(String entityName, Serializable identifier) {
  EntityPersister p = getEntityPersister( entityName );
  if ( p.hasCache() ) {
    if ( LOG.isDebugEnabled() ) {
      LOG.debugf( "Evicting second-level cache: %s",
          MessageHelper.infoString( p, identifier, SessionFactoryImpl.this ) );
    }
    p.getCacheAccessStrategy().evict( buildCacheKey( identifier, p ) );
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

private boolean isCached(EntityKey entityKey, EntityPersister persister) {
  if ( persister.hasCache() ) {
    CacheKey key = context.getSession().generateCacheKey(
        entityKey.getIdentifier(),
        persister.getIdentifierType(),
        entityKey.getEntityName()
    );
    return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null;
  }
  return false;
}
origin: org.infinispan/infinispan-hibernate-cache-v51

@Override
public boolean update(Object session, Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
  return unwrapEntity().update(unwrap(session), key, value, currentVersion, previousVersion);
}
origin: org.infinispan/infinispan-hibernate-cache-v51

@Override
public boolean insert(Object session, Object key, Object value, Object version) throws CacheException {
  return unwrapEntity().insert(unwrap(session), key, value, version);
}
origin: org.hibernate/com.springsource.org.hibernate.core

public void evictEntityRegion(String entityName) {
  EntityPersister p = getEntityPersister( entityName );
  if ( p.hasCache() ) {
    if ( LOG.isDebugEnabled() ) {
      LOG.debugf( "Evicting second-level cache: %s", p.getEntityName() );
    }
    p.getCacheAccessStrategy().evictAll();
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

    persister.getRootEntityName()
);
lock = persister.getCacheAccessStrategy().lockItem( ck, previousVersion );
  persister.getCacheAccessStrategy().remove( ck );
  );
  cacheEntry = persister.getCacheEntryStructure().structure( ce );
  boolean put = persister.getCacheAccessStrategy().update( ck, cacheEntry, nextVersion, previousVersion );
  if ( put && factory.getStatistics().isStatisticsEnabled() ) {
    factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
origin: org.hibernate/com.springsource.org.hibernate

@Override
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws CacheException {
  EntityPersister persister = getPersister();
  if ( persister.hasCache() ) {
    
    final CacheKey ck = getSession().generateCacheKey(
        getId(), 
        persister.getIdentifierType(), 
        persister.getRootEntityName()
      );
    
    if ( success && cacheEntry!=null /*!persister.isCacheInvalidationRequired()*/ ) {
      boolean put = persister.getCacheAccessStrategy().afterUpdate( ck, cacheEntry, nextVersion, previousVersion, lock );
      
      if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
        getSession().getFactory().getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
      }
    }
    else {
      persister.getCacheAccessStrategy().unlockItem( ck, lock );
    }
  }
  postCommitUpdate();
}
origin: org.hibernate/com.springsource.org.hibernate.core

persister.getCacheAccessStrategy().update(
    cacheKey,
    persister.getCacheEntryStructure().structure( entry ),
boolean put = persister.getCacheAccessStrategy().putFromLoad(
    cacheKey,
    persister.getCacheEntryStructure().structure( entry ),
  factory.getStatisticsImplementor().secondLevelCachePut( persister.getCacheAccessStrategy().getRegion().getName() );
origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws HibernateException {
  EntityPersister persister = getPersister();
  if ( success && isCachePutEnabled( persister, getSession() ) ) {
    final CacheKey ck = getSession().generateCacheKey( getId(), persister.getIdentifierType(), persister.getRootEntityName() );
    boolean put = persister.getCacheAccessStrategy().afterInsert( ck, cacheEntry, version );
    
    if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
      getSession().getFactory().getStatisticsImplementor()
          .secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
    }
  }
  postCommitInsert();
}
org.hibernate.cache.spi.accessEntityRegionAccessStrategy

Javadoc

Contract for managing transactional and concurrent access to cached entity data. The expected call sequences related to various operations are:
  • INSERTS : #insert -> #afterInsert
  • UPDATES : #lockItem -> #update -> #afterUpdate
  • DELETES : #lockItem -> #remove -> #unlockItem

There is another usage pattern that is used to invalidate entries after performing "bulk" HQL/SQL operations: #lockRegion -> #removeAll -> #unlockRegion

Most used methods

  • getRegion
    Get the wrapped entity cache region
  • afterInsert
  • afterUpdate
  • insert
  • update
  • evict
  • evictAll
  • get
  • lockItem
  • lockRegion
  • putFromLoad
  • remove
  • putFromLoad,
  • remove,
  • removeAll,
  • unlockItem,
  • unlockRegion

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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