Fixed issue 36610: 3* flush called to insert/save 1 record in generated windows
authorInigo Sanchez <inigo.sanchez@openbravo.com>
Fri, 06 Oct 2017 09:56:55 +0200
changeset 32855 34c067c8eef2
parent 32854 496379681c62
child 32856 b29f889862c9
Fixed issue 36610: 3* flush called to insert/save 1 record in generated windows

Those flushes were added for pre/post actions, which in most of the cases are unimplemented. For this
reason, removing those two flushes would improve the common case.

After removing those flushes, it is required to move those flushes to pre/post actions implemented in
org.openbravo.module.resources module.

The problem has been resolved because the extra flushes are removed.
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Thu Oct 05 18:31:11 2017 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri Oct 06 09:56:55 2017 +0200
@@ -1120,23 +1120,11 @@
 
     } catch (JSONException e) {
       throw new OBException(e);
-    } finally {
-      if (DataSourceAction.FETCH != action) {
-        // Only flush non fetch operations.
-        OBDal.getInstance().flush();
-      }
     }
   }
 
   protected String doPostAction(Map<String, String> parameters, String content,
       DataSourceAction action, String originalObject) {
-    if (action == DataSourceAction.FETCH) {
-      // Clear session to prevent slow flush
-      OBDal.getInstance().getSession().clear();
-    } else {
-      OBDal.getInstance().flush();
-    }
-
     try {
       // this gets the data before the insert, so that it can be used
       // for preprocessing, for example inserting an order