Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033709
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSminorhave not tried2016-08-12 18:072016-08-29 09:59
ReportershuehnerView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionfixedFixed in VersionRR16Q4
StatusclosedFix in branchFixed in SCM revisionf45d8a4e733b
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomtaal
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033709: Double query for posterminal in POSUtil.getLastDocumentNumber*ForPos

DescriptionThose 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 Reproduce1.) Login into WebPOS
2.) Review queries done to obpos_applications coming from the above locations.

Notice .count() for each query followed by a select *
TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0033767 closedplatform Openbravo ERP Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object 
blocks design defect 0036898 newTriage Finance Openbravo ERP Performance issues when using DAL 

-  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
Powered by Mantis Bugtracker