Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033811Openbravo ERPA. Platformpublic2016-08-24 11:412016-08-25 15:21
shuehner 
aferraz 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q3.13.0PR16Q3.1 
caristu
Core
No
0033811: Accidental double query in PriceListVersionFilterExpressionName (order lines, product selector dropdown)
That class has double query m_pricelist_version and also is missing a limit 1 so could lead to high mem usage.

Note: Code seems to be very similar or identical to the change reported in issue 33705
with debugging code from https://issues.openbravo.com/view.php?id=33767 [^]

Open Sales Order
create new header
In lines tab
Create new record in grid view
Click on product selector drop down and see debugging code fire
No tags attached.
blocks defect 0033790 closed shuehner Accidental double query in PriceListVersionFilterExpressionName (order lines, product selector dropdown) 
Issue History
2016-08-25 14:25aferrazTypedefect => backport
2016-08-25 14:25aferrazTarget Version => 3.0PR16Q3.1
2016-08-25 15:17hgbotCheckin
2016-08-25 15:17hgbotNote Added: 0089404
2016-08-25 15:17hgbotStatusscheduled => resolved
2016-08-25 15:17hgbotResolutionopen => fixed
2016-08-25 15:17hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/c35e5b050f0baa6289ac1cb8c4b17fac389591c3 [^] => http://code.openbravo.com/erp/backports/3.0PR16Q3.1/rev/2e42526dc0b5e31dc91bcf640a15975287383b7a [^]
2016-08-25 15:17aferrazAssigned Toshuehner => aferraz
2016-08-25 15:21caristuNote Added: 0089406
2016-08-25 15:21caristuStatusresolved => closed
2016-08-25 15:21caristuFixed in Version => 3.0PR16Q3.1

Notes
(0089404)
hgbot   
2016-08-25 15:17   
Repository: erp/backports/3.0PR16Q3.1
Changeset: 2e42526dc0b5e31dc91bcf640a15975287383b7a
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Aug 25 15:16:24 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.1/rev/2e42526dc0b5e31dc91bcf640a15975287383b7a [^]

Fixed 33811. Avoid double query with .count() + .list(). Add limit 1 to query

Query did .count() + then retrieve 1 record after adding extra order by.

This change removes the count as it only adds extra overhead and directly
does the real .list() query.
As the code only uses single row of result add extra limit 1 to reduce
number of result rows loaded into memory if many match the filter.
Simply code to use .uniqueResult() instead of .list().get(0)

---
M src/org/openbravo/erpCommon/info/PriceListVersionFilterExpressionName.java
---
(0089406)
caristu   
2016-08-25 15:21   
Code reviewed