Author: ashish
Date: Wed Mar 11 05:23:47 2015
New Revision: 1665763
URL:
http://svn.apache.org/r1665763Log:
Applied bug fix from trunk r1665311.
=========================================
Fix bug in EntityQuery where performing queryFirst() while using cache and filtering by date would return invalid results due to the database result being prematurely limited by setMaxRows(1). The full result is needed before we can properly perform in memory date filtering. Thanks to Deepak Dixit for the bug report
=========================================
Modified:
ofbiz/branches/release14.12/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
Modified: ofbiz/branches/release14.12/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1665763&r1=1665762&r2=1665763&view=diff==============================================================================
--- ofbiz/branches/release14.12/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java (original)
+++ ofbiz/branches/release14.12/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Wed Mar 11 05:23:47 2015
@@ -401,7 +401,10 @@ public class EntityQuery {
*/
public GenericValue queryFirst() throws GenericEntityException {
EntityFindOptions efo = makeEntityFindOptions();
- efo.setMaxRows(1);
+ // Only limit results when the query isn't filtering by date in memory against a cached result
+ if (!this.useCache && !this.filterByDate) {
+ efo.setMaxRows(1);
+ }
GenericValue result = EntityUtil.getFirst(query(efo));
return result;
}