final Type[] resultTypes) {
QueryCache queryCache = factory.getQueryCache( queryParameters.getCacheRegion() );
QueryKey key = generateQueryKey( session, queryParameters );
if ( querySpaces == null || querySpaces.size() == 0 ) {
log.trace( "unexpected querySpaces is "+( querySpaces == null ? "null" : "empty" ) );
}
else {
log.trace( "querySpaces is "+querySpaces.toString() );
}
List result = getResultFromQueryCache(
session,
queryParameters,
querySpaces,
resultTypes,
queryCache,
key
);
if ( result == null ) {
result = doList( session, queryParameters, key.getResultTransformer() );
putResultInQueryCache(
session,
queryParameters,
resultTypes,
queryCache,
key,
result
);
}
ResultTransformer resolvedTransformer = resolveResultTransformer( queryParameters.getResultTransformer() );
if ( resolvedTransformer != null ) {
result = (
areResultSetRowsTransformedImmediately() ?
key.getResultTransformer().retransformResults(
result,
getResultRowAliases(),
queryParameters.getResultTransformer(),
includeInResultRow()
) :
key.getResultTransformer().untransformToTuples(
result
)
);
}