Package org.hibernate.cache.spi

Examples of org.hibernate.cache.spi.CacheKey


      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = source.generateCacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
          persister.getRootEntityName()
View Full Code Here


      // we can't use cache here
      return null;
    }

    final SessionFactoryImplementor factory = source.getFactory();
    final CacheKey ck = source.generateCacheKey(
        event.getEntityId(),
        persister.getIdentifierType(),
        persister.getRootEntityName()
    );
View Full Code Here

        if (!useCache) return false;

        final SessionFactoryImplementor factory = source.getFactory();

        final CacheKey ck = source.generateCacheKey( id, persister.getKeyType(), persister.getRole() );
        Object ce = persister.getCacheAccessStrategy().get(ck, source.getTimestamp());

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

    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Initializing lazy properties of: {0}, field access: {1}", MessageHelper.infoString( this, id, getFactory() ), 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, factory);
        if ( !cacheEntry.areLazyPropertiesUnfetched() ) {
          //note early exit here:
View Full Code Here

      return result;
    }

    // check to see if it is in the second-level cache
    if ( hasCache() ) {
      CacheKey ck = session.generateCacheKey( id, getIdentifierType(), getRootEntityName() );
      if ( getCacheAccessStrategy().get( ck, session.getTimestamp() ) != null ) {
        return Boolean.FALSE;
      }
    }
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 {
    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() );
      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

        );
      }

      Object version = Versioning.getVersion(hydratedState, persister);
      CacheEntry entry = persister.buildCacheEntry( entity, hydratedState, version, session );
      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

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.