Package org.hibernate.cache.spi

Examples of org.hibernate.cache.spi.CacheKey


      this.lock = lock;
    }

    @Override
    public void doAfterTransactionCompletion(boolean success, SessionImplementor session) {
      final CacheKey ck = session.generateCacheKey(
          key,
          persister.getKeyType(),
          persister.getRole()
      );
      persister.getCacheAccessStrategy().unlockItem( ck, lock );
View Full Code Here


  @Override
  public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws HibernateException {
    final EntityPersister persister = getPersister();
    if ( success && isCachePutEnabled( persister, getSession() ) ) {
      final CacheKey ck = getSession().generateCacheKey( getId(), persister.getIdentifierType(), persister.getRootEntityName() );
      final boolean put = cacheAfterInsert( persister, ck );

      if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
        getSession().getFactory().getStatisticsImplementor()
            .secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
View Full Code Here

      p.getCacheAccessStrategy().evict( buildCacheKey( identifier, p ) );
    }
  }

  private CacheKey buildCacheKey(Serializable identifier, EntityPersister p) {
    return new CacheKey(
        identifier,
        p.getIdentifierType(),
        p.getRootEntityName(),
        null,                         // have to assume non tenancy
        sessionFactory
View Full Code Here

        LOG.debugf(
            "Evicting second-level cache: %s",
            MessageHelper.collectionInfoString( p, ownerIdentifier, sessionFactory )
        );
      }
      CacheKey cacheKey = buildCacheKey( ownerIdentifier, p );
      p.getCacheAccessStrategy().evict( cacheKey );
    }
  }
View Full Code Here

      p.getCacheAccessStrategy().evict( cacheKey );
    }
  }

  private CacheKey buildCacheKey(Serializable ownerIdentifier, CollectionPersister p) {
    return new CacheKey(
        ownerIdentifier,
        p.getKeyType(),
        p.getRole(),
        null,                        // have to assume non tenancy
        sessionFactory
View Full Code Here

      // we have issues with generated-version entities that may have
      // multiple actions queued during the same flush
      previousVersion = persister.getVersion( instance );
    }
   
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = session.generateCacheKey(
          id,
          persister.getIdentifierType(),
          persister.getRootEntityName()
View Full Code Here

  @Override
  public void doAfterTransactionCompletion(boolean success, SessionImplementor session) throws CacheException {
    final EntityPersister persister = getPersister();
    if ( persister.hasCache() ) {
     
      final CacheKey ck = getSession().generateCacheKey(
          getId(),
          persister.getIdentifierType(),
          persister.getRootEntityName()
      );
     
View Full Code Here

          getState(),
          version,
          session
      );
      cacheEntry = persister.getCacheEntryStructure().structure( ce );
      final CacheKey ck = session.generateCacheKey( id, persister.getIdentifierType(), persister.getRootEntityName() );

      final boolean put = cacheInsert( persister, ck );

      if ( put && factory.getStatistics().isStatisticsEnabled() ) {
        factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
View Full Code Here

        );
      }

      final Object version = Versioning.getVersion( hydratedState, persister );
      final CacheEntry entry = persister.buildCacheEntry( entity, hydratedState, version, session );
      final CacheKey cacheKey = session.generateCacheKey( id, persister.getIdentifierType(), persister.getRootEntityName() );

      // explicit handling of caching for rows just inserted and then somehow forced to be read
      // from the database *within the same transaction*.  usually this is done by
      //     1) Session#refresh, or
      //     2) Session#clear + some form of load
View Full Code Here

    if ( !useCache ) {
      return false;
    }

    final SessionFactoryImplementor factory = source.getFactory();
    final CacheKey ck = source.generateCacheKey( id, persister.getKeyType(), persister.getRole() );
    final Object ce = CacheHelper.fromSharedCache( source, ck, persister.getCacheAccessStrategy() );

    if ( factory.getStatistics().isStatisticsEnabled() ) {
      if ( ce == null ) {
        factory.getStatisticsImplementor()
View Full Code Here

TOP

Related Classes of org.hibernate.cache.spi.CacheKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.