HHH-2592 : apply limit even when no limit specified :/
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15190 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
96dc5e8a26
commit
f85f5cc0c8
|
@ -767,6 +767,16 @@ public abstract class Dialect {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generally, if there is no limit applied to a Hibernate query we do not apply any limits
|
||||
* to the SQL query. This option forces that the limit be written to the SQL query.
|
||||
*
|
||||
* @return True to force limit into SQL query even if none specified in Hibernate query; false otherwise.
|
||||
*/
|
||||
public boolean forceLimitUsage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this dialect's LIMIT support (if any) additionally
|
||||
* support specifying an offset?
|
||||
|
|
|
@ -1526,7 +1526,7 @@ public abstract class Loader {
|
|||
* LIMIT clause.
|
||||
*/
|
||||
private static boolean useLimit(final RowSelection selection, final Dialect dialect) {
|
||||
return dialect.supportsLimit() && hasMaxRows( selection );
|
||||
return dialect.supportsLimit() && ( hasMaxRows( selection ) || dialect.forceLimitUsage() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue