Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033706Openbravo ERPA. Platformpublic2016-08-12 17:362016-08-24 22:47
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q4 
caristu
Core
No
0033706: SelectorDataSourceFilter does accidental extra queries in 'Add Payment' flow of Sales Orders
This class does some accidental extra queries by calling .list() several time for the same OBCriteria instance.

        OBCriteria<Parameter> qParam = OBDal.getInstance().createCriteria(Parameter.class);
        qParam.add(Restrictions.eq(Parameter.PROPERTY_ID,
            parameters.get(SelectorConstants.DS_REQUEST_SELECTOR_FIELD_ID)));

        Parameter param = qParam.list().get(0);
        Validation validation = qParam.list().get(0).getValidation();
        if (validation != null) {
          if (validation.getType().equals("HQL_JS")) {
            String validationCode = qParam.list().get(0).getValidation().getValidationCode();

Also that code does read parameter via its primary key.

So query could instead be just a OBDal.getInstance().get call
1.) Create sales order with 1 line and book it.
2.) Open 'Add Payment' via toolbar button
3.) Review extra queries to obuiapp_parameter done in step 2
Performance
related to defect 0033704 closed shuehner Accidental double query in 'selector dropdown' of new style selectors 
related to feature request 0033767 closed platform Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object 
related to design defect 0036898 new Triage Finance Performance issues when using DAL 
Issue History
2016-08-12 17:36shuehnerNew Issue
2016-08-12 17:36shuehnerAssigned To => platform
2016-08-12 17:36shuehnerModules => Core
2016-08-12 17:36shuehnerTriggers an Emergency Pack => No
2016-08-12 17:36shuehnerRelationship addedrelated to 0033704
2016-08-12 17:38shuehnerDescription Updatedbug_revision_view_page.php?rev_id=12832#r12832
2016-08-12 18:09shuehnerTag Attached: Performance
2016-08-12 18:09shuehnerAssigned Toplatform => shuehner
2016-08-23 14:33hgbotCheckin
2016-08-23 14:33hgbotNote Added: 0089304
2016-08-23 14:33hgbotStatusnew => resolved
2016-08-23 14:33hgbotResolutionopen => fixed
2016-08-23 14:33hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/741a356c2150eeefa997b0dbbef653349330cd4f [^]
2016-08-23 14:34shuehnerReview Assigned To => caristu
2016-08-23 14:44shuehnerRelationship addedrelated to 0033767
2016-08-24 15:50hgbotCheckin
2016-08-24 15:50hgbotNote Added: 0089358
2016-08-24 15:51caristuNote Added: 0089359
2016-08-24 15:51caristuStatusresolved => closed
2016-08-24 15:51caristuFixed in Version => 3.0PR16Q4
2016-08-24 22:47hudsonbotCheckin
2016-08-24 22:47hudsonbotNote Added: 0089369
2017-09-19 18:49markmm82Relationship addedrelated to 0036898

Notes
(0089304)
hgbot   
2016-08-23 14:33   
Repository: erp/devel/pi
Changeset: 741a356c2150eeefa997b0dbbef653349330cd4f
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Fri Aug 12 17:43:20 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/741a356c2150eeefa997b0dbbef653349330cd4f [^]

Fixed 33706. Replace triple .list() call by single query.

Avoid 2 extra queries by saving .list() result instead of calling it 3 times.

Simplify query to OBDal.get (by primary key) as that is only filter which was
used in the OBCriteria.

---
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDataSourceFilter.java
---
(0089358)
hgbot   
2016-08-24 15:50   
Repository: erp/devel/pi
Changeset: a730e671babce9926f44e0c2b59fd4b474afe693
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Aug 24 15:49:21 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a730e671babce9926f44e0c2b59fd4b474afe693 [^]

related to issue 33706: code review improvements

---
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDataSourceFilter.java
---
(0089359)
caristu   
2016-08-24 15:51   
Code review + testing OK: removed extra queries to obuiapp_parameter table
(0089369)
hudsonbot   
2016-08-24 22:47   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/badbe5df5566 [^]
Maturity status: Test