Author: doogie
Date: Thu Nov 26 01:33:38 2009
New Revision: 884363
URL:
http://svn.apache.org/viewvc?rev=884363&view=revLog:
Helper method to fetch all rows/values from a query.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java?rev=884363&r1=884362&r2=884363&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java Thu Nov 26 01:33:38 2009
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.concurrent.Callable;
import javolution.util.FastList;
import javolution.util.FastMap;
@@ -35,6 +36,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.model.DynamicViewEntity;
import org.ofbiz.entity.model.ModelKeyMap;
+import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.sql.SelectPlan;
@@ -67,6 +69,20 @@
return delegator.findListIteratorByCondition(dve, whereCondition, havingCondition, null, orderBy, null);
}
+ public List<GenericValue> getAll(final GenericDelegator delegator, final Map<String, ? extends Object> params) throws GenericEntityException {
+ return TransactionUtil.doTransaction("sql select", new Callable<List<GenericValue>>() {
+ public List<GenericValue> call() throws Exception {
+ EntityListIterator it = null;
+ try {
+ it = getEntityListIterator(delegator, params);
+ return it.getCompleteList();
+ } finally {
+ if (it != null) it.close();
+ }
+ }
+ });
+ }
+
public DynamicViewEntity getDynamicViewEntity() {
return dve;
}