details:   https://code.openbravo.com/erp/devel/pi/rev/722a613b7adc
changeset: 17818:722a613b7adc
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Fri Aug 31 15:04:45 2012 +0200
summary:   Fixes issue 21526: Moves commitAndStart out of the loop.

diffstat:

 src/org/openbravo/costing/CostingMigrationProcess.java |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 8af60f70a49c -r 722a613b7adc 
src/org/openbravo/costing/CostingMigrationProcess.java
--- a/src/org/openbravo/costing/CostingMigrationProcess.java    Fri Aug 31 
14:30:18 2012 +0200
+++ b/src/org/openbravo/costing/CostingMigrationProcess.java    Fri Aug 31 
15:04:45 2012 +0200
@@ -284,10 +284,11 @@
           updateTrxLegacyCosts(cost, stdPrecission, naturalTree);
 
           if ((i % 100) == 0) {
-            SessionHandler.getInstance().commitAndStart();
+            OBDal.getInstance().flush();
             OBDal.getInstance().getSession().clear();
           }
         }
+        SessionHandler.getInstance().commitAndStart();
       }
     }
 
@@ -585,9 +586,9 @@
         // Shipments with accounting date different than the movement date 
gets the cost valid on
         // the accounting date.
         BigDecimal unitCost = new BigDecimal(new 
ProductInfo(cost.getProduct().getId(),
-            new 
DalConnectionProvider()).getProductItemCost(OBDateUtils.formatDate(trx
+            new 
DalConnectionProvider(false)).getProductItemCost(OBDateUtils.formatDate(trx
             .getGoodsShipmentLine().getShipmentReceipt().getAccountingDate()), 
null, "AV",
-            new DalConnectionProvider(), OBDal.getInstance().getConnection()));
+            new DalConnectionProvider(false), 
OBDal.getInstance().getConnection()));
         BigDecimal trxCost = 
unitCost.multiply(trx.getMovementQuantity().abs()).setScale(
             standardPrecision, BigDecimal.ROUND_HALF_UP);
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to