Fix NPE with cache key
This commit is contained in:
parent
16f4a10908
commit
ac1123be05
|
@ -348,13 +348,23 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
cacheMode.name()
|
||||
);
|
||||
cachedResults = null;
|
||||
queryResultsCacheKey = null;
|
||||
if ( queryCacheEnabled ) {
|
||||
queryResultsCacheKey = QueryKey.from(
|
||||
jdbcSelect.getSql(),
|
||||
executionContext.getQueryOptions().getLimit(),
|
||||
executionContext.getQueryParameterBindings(),
|
||||
session
|
||||
);
|
||||
}
|
||||
else {
|
||||
queryResultsCacheKey = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cachedResults == null ) {
|
||||
return new JdbcValuesResultSetImpl(
|
||||
resultSetAccess,
|
||||
canBeCached ? queryResultsCacheKey : null,
|
||||
canBeCached && queryCacheEnabled ? queryResultsCacheKey : null,
|
||||
queryIdentifier,
|
||||
executionContext.getQueryOptions(),
|
||||
jdbcValuesMapping,
|
||||
|
|
|
@ -52,13 +52,15 @@ public class QueryCachePutManagerEnabledImpl implements QueryCachePutManager {
|
|||
|
||||
@Override
|
||||
public void finishUp(SharedSessionContractImplementor session) {
|
||||
final boolean put = queryCache.put(
|
||||
queryKey,
|
||||
dataToCache,
|
||||
session
|
||||
);
|
||||
if ( put && statistics.isStatisticsEnabled() ) {
|
||||
statistics.queryCachePut( queryIdentifier, queryCache.getRegion().getName() );
|
||||
if ( queryKey != null ) {
|
||||
final boolean put = queryCache.put(
|
||||
queryKey,
|
||||
dataToCache,
|
||||
session
|
||||
);
|
||||
if ( put && statistics.isStatisticsEnabled() ) {
|
||||
statistics.queryCachePut( queryIdentifier, queryCache.getRegion().getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue