Openbravo Issue Tracking System - Openbravo ERP | ||||||||||||||||||||||||||
View Issue Details | ||||||||||||||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||||||||||||||||
0033816 | Openbravo ERP | A. Platform | public | 2016-08-25 16:18 | 2016-12-23 08:44 | |||||||||||||||||||||
Reporter | caristu | |||||||||||||||||||||||||
Assigned To | caristu | |||||||||||||||||||||||||
Priority | urgent | Severity | major | Reproducibility | have not tried | |||||||||||||||||||||
Status | closed | Resolution | fixed | |||||||||||||||||||||||
Platform | OS | 5 | OS Version | |||||||||||||||||||||||
Product Version | ||||||||||||||||||||||||||
Target Version | Fixed in Version | 3.0PR17Q1 | ||||||||||||||||||||||||
Merge Request Status | ||||||||||||||||||||||||||
Review Assigned To | alostale | |||||||||||||||||||||||||
OBNetwork customer | ||||||||||||||||||||||||||
Web browser | ||||||||||||||||||||||||||
Modules | Core | |||||||||||||||||||||||||
Support ticket | ||||||||||||||||||||||||||
Regression level | ||||||||||||||||||||||||||
Regression date | ||||||||||||||||||||||||||
Regression introduced in release | ||||||||||||||||||||||||||
Regression introduced by commit | ||||||||||||||||||||||||||
Triggers an Emergency Pack | No | |||||||||||||||||||||||||
Summary | 0033816: Find a complete solution to protect OBCriteria.initialize() against multiple calls per instance | |||||||||||||||||||||||||
Description | OBCriteria has an internal initialize() method which adds the usual client,org,isactive filters. However that initialize() method is not protected against multiple calls per instance. So calling it more than once adds those filters also multiple times. Several are at least 2 sequences triggering this a.) call .count() + .uniqueResult() manually from application as seen i.e. in WebPOS OrderLoader: final OBCriteria<Locator> locators = OBDal.getInstance().createCriteria(Locator.class); locators.add(Restrictions.eq(Locator.PROPERTY_ACTIVE, true)); locators.add(Restrictions.eq(Locator.PROPERTY_WAREHOUSE, shipment.getWarehouse())); // note the count causes a query but the good thing is that it doesn't cause loading // additional bin locations if there are too many if (locators.count() == 1) { foundSingleBin = (Locator) locators.uniqueResult(); b.) But also .count() implementation itself calls initialize() and then uniqueResult() (calling it again). | |||||||||||||||||||||||||
Steps To Reproduce | Trace all SQL's done by OrderLoader starting at part in createShipmentLines if (locators.count() == 1) { foundSingleBin = (Locator) locators.uniqueResult(); That SQL run by the .count() already has 3 blocks of the client+org filters happening (2 copies by this bug) + additional one reported as issue 33132. Then the next SQL run by the manual uniqueResult added 2 more copies of the filters. (one by itself and maybe 2nd one because of that same 33132). | |||||||||||||||||||||||||
Proposed Solution | Add isInitialized boolean or similar to OBCriteria.initialize(). Take into account the possible reuse of the OBCriteria instance after fired a query. Solution applied on issue 33138 was reverted on issue 33814 as it was not complete. | |||||||||||||||||||||||||
Additional Information | ||||||||||||||||||||||||||
Tags | No tags attached. | |||||||||||||||||||||||||
Relationships |
| |||||||||||||||||||||||||
Attached Files | ||||||||||||||||||||||||||
Issue History | ||||||||||||||||||||||||||
Date Modified | Username | Field | Change | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | New Issue | ||||||||||||||||||||||||
2016-08-25 16:18 | caristu | Assigned To | => alostale | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | Modules | => Core | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | Triggers an Emergency Pack | => No | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | Issue generated from | 0033138 | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | Assigned To | alostale => platform | |||||||||||||||||||||||
2016-08-25 16:18 | caristu | Relationship added | related to 0033814 | |||||||||||||||||||||||
2016-08-26 08:07 | caristu | Relationship added | related to 0033138 | |||||||||||||||||||||||
2016-08-26 08:08 | caristu | Summary | OBCriteria.initialize() is not protected against multiple calls per instance => Find a complete solution to protect OBCriteria.initialize() against multiple calls per instance | |||||||||||||||||||||||
2016-08-26 08:08 | caristu | Proposed Solution updated | ||||||||||||||||||||||||
2016-12-01 13:14 | alostale | Status | new => acknowledged | |||||||||||||||||||||||
2016-12-01 13:17 | alostale | Priority | normal => urgent | |||||||||||||||||||||||
2016-12-01 14:30 | alostale | Assigned To | platform => caristu | |||||||||||||||||||||||
2016-12-16 14:33 | caristu | Status | acknowledged => scheduled | |||||||||||||||||||||||
2016-12-19 10:21 | caristu | Relationship added | related to 0033767 | |||||||||||||||||||||||
2016-12-19 10:37 | hgbot | Checkin | ||||||||||||||||||||||||
2016-12-19 10:37 | hgbot | Note Added: 0092757 | ||||||||||||||||||||||||
2016-12-19 10:37 | hgbot | Status | scheduled => resolved | |||||||||||||||||||||||
2016-12-19 10:37 | hgbot | Resolution | open => fixed | |||||||||||||||||||||||
2016-12-19 10:37 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/8a7ca1c913edeb3aeb8ce0ed21748da90e234835 [^] | |||||||||||||||||||||||
2016-12-19 10:52 | caristu | Review Assigned To | => alostale | |||||||||||||||||||||||
2016-12-19 10:52 | caristu | Issue Monitored: alostale | ||||||||||||||||||||||||
2016-12-19 23:17 | hudsonbot | Checkin | ||||||||||||||||||||||||
2016-12-19 23:17 | hudsonbot | Note Added: 0092792 | ||||||||||||||||||||||||
2016-12-23 08:44 | alostale | Note Added: 0092957 | ||||||||||||||||||||||||
2016-12-23 08:44 | alostale | Status | resolved => closed | |||||||||||||||||||||||
2016-12-23 08:44 | alostale | Fixed in Version | => 3.0PR17Q1 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|