mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 04:34:49 +00:00
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 boolean supportsLimit() {
|
||||
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 @@ private static int getFirstRow(RowSelection selection) {
|
||||
* 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…
x
Reference in New Issue
Block a user