Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038135Openbravo ERPA. Platformpublic2018-03-14 12:502018-03-21 14:28
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0PR18Q2 
alostale
Core
No
0038135: OBContext.getOrganizationList is not using bind-parameters
This code is not using bind-params

    final Query qry = SessionHandler.getInstance().createQuery(
        "select o.id from " + Organization.class.getName() + " o, "
            + RoleOrganization.class.getName() + " roa where o." + Organization.PROPERTY_ID
            + "=roa." + RoleOrganization.PROPERTY_ORGANIZATION + "." + Organization.PROPERTY_ID
            + " and roa." + RoleOrganization.PROPERTY_ROLE + "." + Organization.PROPERTY_ID + "='"
            + targetRole.getId() + "' and roa." + RoleOrganization.PROPERTY_ACTIVE + "='Y' and o."
            + Organization.PROPERTY_ACTIVE + "='" + propertyActive + "'");
    @SuppressWarnings("unchecked")
    List<String> currentOrgList = qry.list();
-
Performance
blocks design defect 0038136 acknowledged platform Tracking issue: Find & Fix queries not using bind-params but embedding values into query string 
Issue History
2018-03-14 12:50shuehnerNew Issue
2018-03-14 12:50shuehnerAssigned To => platform
2018-03-14 12:50shuehnerModules => Core
2018-03-14 12:50shuehnerTriggers an Emergency Pack => No
2018-03-14 13:04shuehnerRelationship addedblocks 0038136
2018-03-14 16:46shuehnerAssigned Toplatform => shuehner
2018-03-15 17:27hgbotCheckin
2018-03-15 17:27hgbotNote Added: 0103288
2018-03-15 17:27hgbotStatusnew => resolved
2018-03-15 17:27hgbotResolutionopen => fixed
2018-03-15 17:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c6e6d9b1a8f052242292dc619c4802b27972e7cb [^]
2018-03-15 17:28shuehnerReview Assigned To => alostale
2018-03-16 09:16hgbotCheckin
2018-03-16 09:16hgbotNote Added: 0103305
2018-03-16 09:16hgbotCheckin
2018-03-16 09:16hgbotNote Added: 0103306
2018-03-16 09:17alostaleTag Attached: Performance
2018-03-16 09:17alostaleNote Added: 0103307
2018-03-16 09:17alostaleStatusresolved => closed
2018-03-16 09:17alostaleFixed in Version => 3.0PR18Q3
2018-03-16 17:29hudsonbotCheckin
2018-03-16 17:29hudsonbotNote Added: 0103330
2018-03-16 17:29hudsonbotCheckin
2018-03-16 17:29hudsonbotNote Added: 0103331
2018-03-21 14:28shuehnerFixed in Version3.0PR18Q3 => 3.0PR18Q2

Notes
(0103288)
hgbot   
2018-03-15 17:27   
Repository: erp/devel/pi
Changeset: c6e6d9b1a8f052242292dc619c4802b27972e7cb
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Thu Mar 15 10:44:22 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/c6e6d9b1a8f052242292dc619c4802b27972e7cb [^]

Fixed 38135. Use bind-parameters instead of mixing data with the HQL-String.

- Modify getOne utility method to receive a Map of parameters to be applied
to the query
- Change all callers to use named parameters in the HQL string and a map
  for the param values
- Remove the 2 extra copies of getOne now no longer required.
- in getOrganizations function
  - change HQL positional parameter to named one as that is better style
    and avoid a future hibernate behavior change

---
M src/org/openbravo/dal/core/OBContext.java
---
(0103305)
hgbot   
2018-03-16 09:16   
Repository: erp/devel/pi
Changeset: 1a95cbaaf72456c7fd4f54889603cbd21c96e68c
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 16 09:04:39 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1a95cbaaf72456c7fd4f54889603cbd21c96e68c [^]

related to bug 38135: auto formatting after last changes

---
M src/org/openbravo/dal/core/OBContext.java
---
(0103306)
hgbot   
2018-03-16 09:16   
Repository: erp/devel/pi
Changeset: 305d3e3c2b9ade187184e068a167d9737744ca5c
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 16 09:13:27 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/305d3e3c2b9ade187184e068a167d9737744ca5c [^]

related to bug 38135: minor changes

  - don't name parameter as clientId if it receives a client object
  - don't oversize param maps as size is fixed and known

---
M src/org/openbravo/dal/core/OBContext.java
---
(0103307)
alostale   
2018-03-16 09:17   
-Tested: there's no change in the resutls
-Reviewed: applied some minor changes
(0103330)
hudsonbot   
2018-03-16 17:29   
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/5323533018b6 [^]
Maturity status: Test
(0103331)
hudsonbot   
2018-03-16 17:29   
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/5323533018b6 [^]
Maturity status: Test