Package org.hibernate.cache.spi

Examples of org.hibernate.cache.spi.CacheKey


    }
  }

  private CacheKey buildCacheKey(Serializable identifier, EntityPersister p) {
    // have to assume non tenancy
    return new CacheKey(
        identifier,
        p.getIdentifierType(),
        p.getRootEntityName(),
        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

    }
  }

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

  @Override
  public CacheKey generateCacheKey(Serializable id, Type type, String entityOrRoleName) {
    final String tenantIdentifier = getTenantIdentifier();
    if ( tenantIdentifier == null ) {
      return new CacheKey( id, type, entityOrRoleName, getFactory() );
    }
    else {
      return new TenantAwareCacheKey( id, type, entityOrRoleName, getFactory(), tenantIdentifier );
    }
  }
View Full Code Here

          session,
          instance
        );
     
      cacheEntry = persister.getCacheEntryStructure().structure(ce);
      final CacheKey ck = session.generateCacheKey( id, persister.getIdentifierType(), persister.getRootEntityName() );
      boolean put = persister.getCacheAccessStrategy().insert( ck, cacheEntry, version );
     
      if ( put && factory.getStatistics().isStatisticsEnabled() ) {
        factory.getStatisticsImplementor().secondLevelCachePut( getPersister().getCacheAccessStrategy().getRegion().getName() );
      }
View Full Code Here

  @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() );
View Full Code Here

          ", field access: " + fieldName
        );
    }

    if ( hasCache() ) {
      CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getEntityName() );
      Object ce = getCacheAccessStrategy().get( cacheKey, session.getTimestamp() );
      if ( ce != null ) {
        CacheEntry cacheEntry = (CacheEntry) getCacheEntryStructure().destructure( ce, getFactory() );
        if ( !cacheEntry.areLazyPropertiesUnfetched() ) {
          // note early exit here:
View Full Code Here

    return new EntityKey( id, persister, getTenantIdentifier() );
  }

  @Override
  public CacheKey generateCacheKey(Serializable id, Type type, String entityOrRoleName) {
    return new CacheKey( id, type, entityOrRoleName, getTenantIdentifier(), getFactory() );
  }
View Full Code Here

          ", field access: " + fieldName
        );
    }

    if ( hasCache() ) {
      CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getEntityName() );
      Object ce = getCacheAccessStrategy().get( cacheKey, session.getTimestamp() );
      if (ce!=null) {
        CacheEntry cacheEntry = (CacheEntry) getCacheEntryStructure().destructure(ce, getFactory());
        if ( !cacheEntry.areLazyPropertiesUnfetched() ) {
          //note early exit here:
View Full Code Here

//          MessageHelper.infoString( persister, id, source.getFactory() )
//      );
//    }

    if ( persister.hasCache() ) {
      final CacheKey ck = generateCacheKey( id, persister.getIdentifierType(), persister.getRootEntityName() );
      persister.getCacheAccessStrategy().evict( ck );
    }

    String previousFetchProfile = this.getFetchProfile();
    Object result = null;
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.