Author: lektran Date: Mon Mar 9 17:34:42 2015 New Revision: 1665311 URL: http://svn.apache.org/r1665311 Log: 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/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1665311&r1=1665310&r2=1665311&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Mon Mar 9 17:34:42 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; }