| It seems that timeout isn't taken in account if there is no row selection. See the method HQLQueryPlan#performList. Here is an extract:
final RowSelection rowSelection = queryParameters.getRowSelection();
final boolean hasLimit = rowSelection != null
&& rowSelection.definesLimits();
final boolean needsLimit = hasLimit && translators.length > 1;
final QueryParameters queryParametersToUse;
if ( needsLimit ) {
LOG.needsLimit();
final RowSelection selection = new RowSelection();
selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() );
selection.setTimeout( queryParameters.getRowSelection().getTimeout() );
queryParametersToUse = queryParameters.createCopyUsing( selection );
}
else {
queryParametersToUse = queryParameters;
}
The problem is when rowSelection is not null and the timeout has been set. Then rowSelection.definesLimits() completely ignores the timeout, and if we don't have a LIMIT/OFFSET, then it returns false and the timeout will not be applied. |