HHH-6076 - query with setFirstResult throws Exception on derby

This commit is contained in:
Strong Liu 2011-04-07 02:03:48 +08:00
parent de38d784c7
commit ef35cd7be3
1 changed files with 9 additions and 10 deletions

View File

@ -1685,16 +1685,15 @@ public abstract class Loader {
return dialect.supportsLimit() && hasMaxRows( selection ); return dialect.supportsLimit() && hasMaxRows( selection );
} }
private ScrollMode getScrollMode(boolean scroll, QueryParameters queryParameters, boolean hasFirstRow, boolean useLimitOffSet) { private ScrollMode getScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters) {
final boolean canScroll = getFactory().getSettings().isScrollableResultSetsEnabled(); final boolean canScroll = getFactory().getSettings().isScrollableResultSetsEnabled();
if ( !canScroll ) { if ( canScroll ) {
return null; if ( scroll ) {
} return queryParameters.getScrollMode();
if ( scroll ) { }
return queryParameters.getScrollMode(); if ( hasFirstRow && !useLimitOffSet ) {
} return ScrollMode.SCROLL_INSENSITIVE;
if ( hasFirstRow && !useLimitOffSet ) { }
return ScrollMode.SCROLL_INSENSITIVE;
} }
return null; return null;
} }
@ -1720,7 +1719,7 @@ public abstract class Loader {
final boolean canScroll = getFactory().getSettings().isScrollableResultSetsEnabled(); final boolean canScroll = getFactory().getSettings().isScrollableResultSetsEnabled();
final boolean useScrollableResultSetToSkip = hasFirstRow && final boolean useScrollableResultSetToSkip = hasFirstRow &&
!useLimitOffset && canScroll; !useLimitOffset && canScroll;
ScrollMode scrollMode = getScrollMode(scroll,queryParameters,hasFirstRow,useLimit); final ScrollMode scrollMode = getScrollMode( scroll, hasFirstRow, useLimit, queryParameters );
// //
// if(canScroll && ( scroll || useScrollableResultSetToSkip )){ // if(canScroll && ( scroll || useScrollableResultSetToSkip )){
// scrollMode = scroll ? queryParameters.getScrollMode() : ScrollMode.SCROLL_INSENSITIVE; // scrollMode = scroll ? queryParameters.getScrollMode() : ScrollMode.SCROLL_INSENSITIVE;