@Override public CacheMode getCacheMode() { return delegate.getCacheMode(); }
/** * Attempts to load the entity from the second-level cache. * * @param event The load event * @param persister The persister for the entity being requested for load * * @return The entity from the second-level cache, or null. */ public Object loadFromSecondLevelCache( final LoadEvent event, final EntityPersister persister, final EntityKey entityKey) { final SessionImplementor source = event.getSession(); final boolean useCache = persister.canReadFromCache() && source.getCacheMode().isGetEnabled() && event.getLockMode().lessThan( LockMode.READ ); if ( !useCache ) { // we can't use cache here return null; } final Object ce = getFromSharedCache( event, persister, source ); if ( ce == null ) { // nothing was found in cache return null; } return processCachedEntry( event, persister, ce, source, entityKey ); }
final boolean useCache = persister.hasCache() && source.getCacheMode().isGetEnabled();
public CacheMode getCacheMode() { return ((SessionImplementor) delegate).getCacheMode(); }
@Override public CacheMode getCacheMode() { return delegate.getCacheMode(); }
public CacheMode getCacheMode() { return session.getCacheMode(); }
private boolean isCachePutEnabled(EntityPersister persister, SessionImplementor session) { return persister.hasCache() && !persister.isCacheInvalidationRequired() && session.getCacheMode().isPutEnabled(); }
private boolean isCachePutEnabled(EntityPersister persister, SessionImplementor session) { return persister.hasCache() && !persister.isCacheInvalidationRequired() && session.getCacheMode().isPutEnabled(); }
protected void before() { if ( flushMode!=null ) { sessionFlushMode = getSession().getFlushMode(); getSession().setFlushMode(flushMode); } if ( cacheMode!=null ) { sessionCacheMode = getSession().getCacheMode(); getSession().setCacheMode(cacheMode); } }
protected void before() { if ( flushMode != null ) { sessionFlushMode = getSession().getFlushMode(); getSession().setFlushMode( flushMode ); } if ( cacheMode != null ) { sessionCacheMode = getSession().getCacheMode(); getSession().setCacheMode( cacheMode ); } }
protected void before() { if ( flushMode != null ) { sessionFlushMode = getSession().getFlushMode(); getSession().setFlushMode( flushMode ); } if ( cacheMode != null ) { sessionCacheMode = getSession().getCacheMode(); getSession().setCacheMode( cacheMode ); } }
protected void before() { if ( flushMode!=null ) { sessionFlushMode = getSession().getFlushMode(); getSession().setFlushMode(flushMode); } if ( cacheMode!=null ) { sessionCacheMode = getSession().getCacheMode(); getSession().setCacheMode(cacheMode); } }
private static boolean useMinimalPuts(SessionImplementor session, EntityEntry entityEntry) { return ( session.getFactory().getSettings().isMinimalPutsEnabled() && session.getCacheMode()!=CacheMode.REFRESH ) || ( entityEntry.getPersister().hasLazyProperties() && entityEntry.isLoadedWithLazyPropertiesUnfetched() && entityEntry.getPersister().isLazyPropertiesCacheable() ); }
private static boolean useMinimalPuts(SessionImplementor session, EntityEntry entityEntry) { return ( session.getFactory().getSettings().isMinimalPutsEnabled() && session.getCacheMode()!=CacheMode.REFRESH ) || ( entityEntry.getPersister().hasLazyProperties() && entityEntry.isLoadedWithLazyPropertiesUnfetched() && entityEntry.getPersister().isLazyPropertiesCacheable() ); }
/** * Attempts to load the entity from the second-level cache. * * @param event The load event * @param entityDescriptor The persister for the entity being requested for load * * @return The entity from the second-level cache, or null. */ public Object loadFromSecondLevelCache( final LoadEvent event, final EntityTypeDescriptor entityDescriptor, final EntityKey entityKey) { final SessionImplementor source = event.getSession(); final boolean useCache = entityDescriptor.canReadFromCache() && source.getCacheMode().isGetEnabled() && event.getLockMode().lessThan( LockMode.READ ); if ( !useCache ) { // we can't use cache here return null; } final Object ce = getFromSharedCache( event, entityDescriptor, source ); if ( ce == null ) { // nothing was found in cache return null; } return processCachedEntry( event, entityDescriptor, ce, source, entityKey ); }
private void putResultInQueryCache( final SessionImplementor session, final QueryParameters queryParameters, final Type[] resultTypes, final QueryCache queryCache, final QueryKey key, final List result) { if ( session.getCacheMode().isPutEnabled() ) { boolean put = queryCache.put( key, key.getResultTransformer().getCachedResultTypes( resultTypes ), result, queryParameters.isNaturalKeyLookup(), session ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor() .queryCachePut( getQueryIdentifier(), queryCache.getRegion().getName() ); } } }
private void putResultInQueryCache( final SessionImplementor session, final QueryParameters queryParameters, final Type[] resultTypes, final QueryCache queryCache, final QueryKey key, final List result) { if ( session.getCacheMode().isPutEnabled() ) { boolean put = queryCache.put( key, key.getResultTransformer().getCachedResultTypes( resultTypes ), result, queryParameters.isNaturalKeyLookup(), session ); if ( put && factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor() .queryCachePut( getQueryIdentifier(), queryCache.getRegion().getName() ); } } }
List result = null; if ( session.getCacheMode().isGetEnabled() ) { boolean isImmutableNaturalKeyLookup = queryParameters.isNaturalKeyLookup() &&
session.getCacheMode().isPutEnabled() &&
session.getCacheMode().isPutEnabled() &&