Author: doogie
Date: Tue May  4 21:19:28 2010
New Revision: 941047

URL: http://svn.apache.org/viewvc?rev=941047&view=rev
Log:
Add some caching to a few delegator calls, a few cases during the
loading of survey data were always hitting the database.

Modified:
    
ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java

Modified: 
ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=941047&r1=941046&r2=941047&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
 (original)
+++ 
ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
 Tue May  4 21:19:28 2010
@@ -242,7 +242,7 @@ public class SurveyWrapper {
     public GenericValue getSurvey() {
         GenericValue survey = null;
         try {
-            survey = delegator.findByPrimaryKey("Survey", 
UtilMisc.toMap("surveyId", surveyId));
+            survey = delegator.findByPrimaryKeyCache("Survey", 
UtilMisc.toMap("surveyId", surveyId));
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to get Survey : " + surveyId, module);
         }
@@ -290,7 +290,7 @@ public class SurveyWrapper {
         try {
             Map fields = UtilMisc.toMap("surveyId", surveyId);
             List order = UtilMisc.toList("sequenceNum", 
"surveyMultiRespColId");
-            questions = delegator.findByAnd("SurveyQuestionAndAppl", fields, 
order);
+            questions = delegator.findByAndCache("SurveyQuestionAndAppl", 
fields, order);
             if (questions != null) {
                 questions = EntityUtil.filterByDate(questions);
             }

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=941047&r1=941046&r2=941047&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 Tue May  4 21:19:28 2010
@@ -511,7 +511,7 @@ public class ProductStoreWorker {
                 } else if (surveyAppl.get("productCategoryId") != null) {
                     List<GenericValue> categoryMembers = null;
                     try {
-                        categoryMembers = 
delegator.findByAnd("ProductCategoryMember", 
UtilMisc.toMap("productCategoryId", surveyAppl.get("productCategoryId")));
+                        categoryMembers = 
delegator.findByAndCache("ProductCategoryMember", 
UtilMisc.toMap("productCategoryId", surveyAppl.get("productCategoryId")));
                     } catch (GenericEntityException e) {
                         Debug.logError(e, "Unable to get ProductCategoryMember 
records for survey application : " + surveyAppl, module);
                     }


Reply via email to