Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0033709 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Web POS | minor | have not tried | 2016-08-12 18:07 | 2016-08-29 09:59 | |||
Reporter | shuehner | View Status | public | |||||
Assigned To | shuehner | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | RR16Q4 | |||
Status | closed | Fix in branch | Fixed in SCM revision | f45d8a4e733b | ||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Review Assigned To | mtaal | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0033709: Double query for posterminal in POSUtil.getLastDocumentNumber*ForPos | |||||||
Description | Those 3 functions in POSUtil do double query to OBPOS_Application each. getLastDocumentNumberForPOS getLastDocumentNumberQuotationForPOS getLastDocumentNumberReturnForPOS OBCriteria<OBPOSApplications> termCrit = OBDal.getInstance().createCriteria( OBPOSApplications.class); termCrit.add(Restrictions.eq(OBPOSApplications.PROPERTY_SEARCHKEY, searchKey)); - if (termCrit.count() != 1) { The code did explicit count() <> 1 check. However as filter is for value field which has a unique constraint the case of >1 cannot happen. So the count+list can be simplified to a simple .uniqueResult() followed by a != null check. | |||||||
Steps To Reproduce | 1.) Login into WebPOS 2.) Review queries done to obpos_applications coming from the above locations. Notice .count() for each query followed by a select * | |||||||
Tags | Performance | |||||||
Attached Files | ||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |||||||||||||||||
|
Notes | |
(0089309) hgbot (developer) 2016-08-23 15:40 |
Repository: erp/pmods/org.openbravo.retail.posterminal Changeset: f45d8a4e733bc770810df0ff283698c746f61970 Author: Stefan Hühner <stefan.huehner <at> openbravo.com> Date: Fri Aug 12 18:09:07 2016 +0200 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f45d8a4e733bc770810df0ff283698c746f61970 [^] Fixed 33709. Avoid 3 extra queries during pos login. The .count() != 1 triggers extra database query which can be avoided. As the filter is for obpos_applications.value which has a unique constraint the case of >1 cannot happen. The 0 or 1 can be easily handled by the existing uniqueResult() call followed by a simple == null check. --- M src/org/openbravo/retail/posterminal/POSUtils.java --- |
(0089484) mtaal (manager) 2016-08-29 09:59 |
Reviewed and tested |
Issue History | |||
Date Modified | Username | Field | Change |
2016-08-12 18:07 | shuehner | New Issue | |
2016-08-12 18:07 | shuehner | Assigned To | => Retail |
2016-08-12 18:07 | shuehner | Triggers an Emergency Pack | => No |
2016-08-12 18:09 | shuehner | Assigned To | Retail => shuehner |
2016-08-12 18:10 | shuehner | Tag Attached: Performance | |
2016-08-23 14:45 | shuehner | Relationship added | related to 0033767 |
2016-08-23 15:40 | hgbot | Checkin | |
2016-08-23 15:40 | hgbot | Note Added: 0089309 | |
2016-08-23 15:40 | hgbot | Status | new => resolved |
2016-08-23 15:40 | hgbot | Resolution | open => fixed |
2016-08-23 15:40 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f45d8a4e733bc770810df0ff283698c746f61970 [^] |
2016-08-23 15:41 | shuehner | Review Assigned To | => mtaal |
2016-08-29 09:59 | mtaal | Note Added: 0089484 | |
2016-08-29 09:59 | mtaal | Status | resolved => closed |
2016-08-29 09:59 | mtaal | Fixed in Version | => RR16Q4 |
2017-09-19 18:50 | markmm82 | Relationship added | blocks 0036898 |
Copyright © 2000 - 2009 MantisBT Group |