details:   https://code.openbravo.com/erp/devel/pi/rev/64c98f878ddb
changeset: 32556:64c98f878ddb
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri Aug 11 11:59:39 2017 +0200
summary:   fixed bug 36636: double flush using DalConnectionProvider(true) if 
con==null

  When trying to get connection from DalConnectionProvider having set 
flush=true,
  extra flush is performed in case there's no connection or it's already closed.

  As flush is performed later, this case should alway retrieve connection 
preventing
  flush.

details:   https://code.openbravo.com/erp/devel/pi/rev/3815628bbb6f
changeset: 32557:3815628bbb6f
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri Aug 11 12:17:29 2017 +0200
summary:   fixed bug 36609: unneeded flushes + commit on every FIC execution

  When executing FIC, before invoking callouts, a flush + commit (including an
  extra flush) was always performed to release any lock that could have been
  acquired before.

  That code was obsolete, as currently FIC does not perform any DB change before
  that point.

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
 |  10 ----------
 src/org/openbravo/service/db/DalConnectionProvider.java                        
                                       |   5 ++---
 2 files changed, 2 insertions(+), 13 deletions(-)

diffs (52 lines):

diff -r 3823a47da98c -r 3815628bbb6f 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Thu Aug 10 11:29:45 2017 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Fri Aug 11 12:17:29 2017 +0200
@@ -21,7 +21,6 @@
 import java.lang.reflect.Method;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -1452,16 +1451,7 @@
       List<JSONObject> messages, List<String> dynamicCols, List<String> 
jsExecuteCode,
       Map<String, Object> hiddenInputs, List<String> 
overwrittenAuxiliaryInputs) {
     HashMap<String, Object> calloutInstances = new HashMap<String, Object>();
-
-    // flush&commit to release lock in db which otherwise interfere with 
callouts which run in their
-    // own jdbc connection (i.e. lock on AD_Sequence when using with Sales 
Invoice window)
-    OBDal.getInstance().flush();
     List<String> changedCols = new ArrayList<String>();
-    try {
-      OBDal.getInstance().getConnection().commit();
-    } catch (SQLException e1) {
-      throw new OBException("Error committing before runnings callouts", e1);
-    }
     List<Field> fields = getADFieldList(tab.getId());
     HashMap<String, Field> inpFields = buildInpField(fields);
     String lastCalledCallout = "";
diff -r 3823a47da98c -r 3815628bbb6f 
src/org/openbravo/service/db/DalConnectionProvider.java
--- a/src/org/openbravo/service/db/DalConnectionProvider.java   Thu Aug 10 
11:29:45 2017 +0200
+++ b/src/org/openbravo/service/db/DalConnectionProvider.java   Fri Aug 11 
12:17:29 2017 +0200
@@ -95,7 +95,7 @@
   public Connection getConnection() throws NoConnectionAvailableException {
     try {
       if (connection == null || connection.isClosed()) {
-        connection = OBDal.getInstance(pool).getConnection(flush);
+        connection = OBDal.getInstance(pool).getConnection(false);
       }
     } catch (SQLException sqlex) {
       log.error("Error checking connection of {} pool", pool, sqlex);
@@ -103,10 +103,9 @@
       // Handle the case of a connection retrieved from Hibernate pool which 
has been already
       // closed. In this case the connection is marked as not usable and when 
we try to check its
       // status a HibernateException is thrown.
-      connection = OBDal.getInstance(pool).getConnection(flush);
+      connection = OBDal.getInstance(pool).getConnection(false);
     }
 
-    // always flush all remaining actions
     if (flush) {
       OBDal.getInstance(pool).flush();
     }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to