Author: steve.ebersole(a)jboss.com
Date: 2008-09-12 00:53:18 -0400 (Fri, 12 Sep 2008)
New Revision: 15189
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/loader/Loader.java
Log:
HHH-2592 : apply limit even when no limit specified :/
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
---
core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java 2008-09-12
04:39:09 UTC (rev 15188)
+++
core/branches/Branch_3_3/core/src/main/java/org/hibernate/dialect/Dialect.java 2008-09-12
04:53:18 UTC (rev 15189)
@@ -768,6 +768,16 @@
}
/**
+ * 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?
*
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/loader/Loader.java
===================================================================
---
core/branches/Branch_3_3/core/src/main/java/org/hibernate/loader/Loader.java 2008-09-12
04:39:09 UTC (rev 15188)
+++
core/branches/Branch_3_3/core/src/main/java/org/hibernate/loader/Loader.java 2008-09-12
04:53:18 UTC (rev 15189)
@@ -1526,7 +1526,7 @@
* LIMIT clause.
*/
private static boolean useLimit(final RowSelection selection, final Dialect dialect) {
- return dialect.supportsLimit() && hasMaxRows( selection );
+ return dialect.supportsLimit() && ( hasMaxRows( selection ) ||
dialect.forceLimitUsage() );
}
/**