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 32600 944c8f82ef0d
parent 32599 8fff4f5469e0
child 32601 2a9757a3a0aa
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 May 04 09:55:58 2017 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri Oct 06 09:56:55 2017 +0200
@@ -1115,23 +1115,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