@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final boolean put = naturalIdCacheAccessStrategy.afterInsert( naturalIdCacheKey, pk ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); } } }
@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final boolean put = naturalIdCacheAccessStrategy.afterUpdate( naturalIdCacheKey, pk, lock ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); } } }
@Override public void evictNaturalIdResolution(EntityPersister persister, final Serializable pk, Object[] naturalIdValues) { if ( !persister.hasNaturalIdentifier() ) { throw new IllegalArgumentException( "Entity did not define a natural-id" ); } if ( persister.getNaturalIdentifierProperties().length != naturalIdValues.length ) { throw new IllegalArgumentException( "Mismatch between expected number of natural-id values and found." ); } NaturalIdResolutionCache entityNaturalIdResolutionCache = naturalIdResolutionCacheMap.get( persister ); if ( entityNaturalIdResolutionCache != null ) { final LocalNaturalIdCacheKey localNaturalIdCacheKey = new LocalNaturalIdCacheKey( persister, naturalIdValues ); entityNaturalIdResolutionCache.pkToNaturalIdMap.remove( pk ); entityNaturalIdResolutionCache.naturalIdToPkMap.remove( localNaturalIdCacheKey ); } if ( persister.hasNaturalIdCache() ) { final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister.getNaturalIdCacheAccessStrategy(); final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session ); naturalIdCacheAccessStrategy.evict( naturalIdCacheKey ); } } }
final boolean put = naturalIdCacheAccessStrategy.putFromLoad( naturalIdCacheKey, pk, .naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); naturalIdCacheAccessStrategy.insert( naturalIdCacheKey, pk ); final SoftLock lock = naturalIdCacheAccessStrategy.lockItem( naturalIdCacheKey, null ); naturalIdCacheAccessStrategy.update( naturalIdCacheKey, pk );
pk = (Serializable) naturalIdCacheAccessStrategy.get( naturalIdCacheKey, session.getTimestamp() ); if ( factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCacheHit( naturalIdCacheAccessStrategy.getRegion().getName() ); factory.getStatisticsImplementor().naturalIdCacheMiss( naturalIdCacheAccessStrategy.getRegion().getName() );
public void evictNaturalIdRegion(String entityName) { EntityPersister p = getEntityPersister( entityName ); if ( p.hasNaturalIdCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", p.getEntityName() ); } p.getNaturalIdCacheAccessStrategy().evictAll(); } }
final String regionName = naturalIdCacheAccessStrategy == null ? null : naturalIdCacheAccessStrategy.getRegion().getName();
final boolean put = naturalIdCacheAccessStrategy.putFromLoad( naturalIdCacheKey, pk, .naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); naturalIdCacheAccessStrategy.insert( naturalIdCacheKey, pk ); final SoftLock lock = naturalIdCacheAccessStrategy.lockItem( naturalIdCacheKey, null ); naturalIdCacheAccessStrategy.update( naturalIdCacheKey, pk );
pk = (Serializable) naturalIdCacheAccessStrategy.get( naturalIdCacheKey, session.getTimestamp() ); if ( factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCacheHit( naturalIdCacheAccessStrategy.getRegion().getName() ); factory.getStatisticsImplementor().naturalIdCacheMiss( naturalIdCacheAccessStrategy.getRegion().getName() );
public void evictNaturalIdRegion(String entityName) { EntityPersister p = getEntityPersister( entityName ); if ( p.hasNaturalIdCache() ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Evicting second-level cache: %s", p.getEntityName() ); } p.getNaturalIdCacheAccessStrategy().evictAll(); } }
final String regionName = naturalIdCacheAccessStrategy == null ? null : naturalIdCacheAccessStrategy.getRegion().getName();
@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final boolean put = naturalIdCacheAccessStrategy.afterUpdate( naturalIdCacheKey, pk, lock ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); } } }
@Override public void doAfterTransactionCompletion(boolean success, SessionImplementor session) { final boolean put = naturalIdCacheAccessStrategy.afterInsert( naturalIdCacheKey, pk ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().naturalIdCachePut( naturalIdCacheAccessStrategy.getRegion().getName() ); } } }
@Override public void evictNaturalIdResolution(EntityPersister persister, final Serializable pk, Object[] naturalIdValues) { if ( !persister.hasNaturalIdentifier() ) { throw new IllegalArgumentException( "Entity did not define a natural-id" ); } if ( persister.getNaturalIdentifierProperties().length != naturalIdValues.length ) { throw new IllegalArgumentException( "Mismatch between expected number of natural-id values and found." ); } NaturalIdResolutionCache entityNaturalIdResolutionCache = naturalIdResolutionCacheMap.get( persister ); if ( entityNaturalIdResolutionCache != null ) { final LocalNaturalIdCacheKey localNaturalIdCacheKey = new LocalNaturalIdCacheKey( persister, naturalIdValues ); entityNaturalIdResolutionCache.pkToNaturalIdMap.remove( pk ); entityNaturalIdResolutionCache.naturalIdToPkMap.remove( localNaturalIdCacheKey ); } if ( persister.hasNaturalIdCache() ) { final NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy = persister.getNaturalIdCacheAccessStrategy(); final NaturalIdCacheKey naturalIdCacheKey = new NaturalIdCacheKey( naturalIdValues, persister, session ); naturalIdCacheAccessStrategy.evict( naturalIdCacheKey ); } } }