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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0037112
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2017-10-19 10:212018-01-03 12:38
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in Version3.0PR18Q1
StatusclosedFix in branchFixed in SCM revision27acf774fde2
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0037112: incorrect HQL to retrieve preferences

DescriptionWhen retrieving preferences without organization, the HQL that is generated has unbalanced parentheses.

Even it's an incorrect HQL, Hibernate manages to somehow generate a valid SQL (although it removes some parts).

Note that most of the times organization parameter is used, this issue appears only when it is not. Main user is login page that has not organization yet.

This same HQL fails in newer (5.2) Hibernate versions.
Steps To ReproduceOpen login page and check hql generated for ForcedLoginURL preference [1] and the SQL it's finally executed.

HQL:
 as p  
 where (coalesce(p.visibleAtClient, '0')='0')  
 and (p.visibleAtRole is null)      
 and (coalesce(p.visibleAtOrganization, '0')='0')) 
 and (p.userContact is null)  
 and (p.window is null)  
 and p.propertyList = 'Y' 
 and p.property = ?  
 order by p.AD_Window_ID


SQL:
  ...
  from AD_Preference adpreferen0_ 
  where coalesce(adpreferen0_.VisibleAt_Client_ID, '0')='0' 
  and (adpreferen0_.VisibleAt_Role_ID is null) 
  and coalesce(adpreferen0_.VisibleAt_Org_ID, '0')='0' 
  and (adpreferen0_.AD_User_ID is null) 
  and (adpreferen0_.AD_Window_ID is null) 
  and adpreferen0_.IsPropertyList='Y' 
  and adpreferen0_.Property=?


Removing the extra parenthesis in the HQL, the correct SQL is:
  from AD_Preference adpreferen0_ 
  where coalesce(adpreferen0_.VisibleAt_Client_ID, '0')='0' 
  and (adpreferen0_.VisibleAt_Role_ID is null) 
  and coalesce(adpreferen0_.VisibleAt_Org_ID, '0')='0' 
  and (adpreferen0_.AD_User_ID is null) 
  and (adpreferen0_.AD_Window_ID is null) 
  and adpreferen0_.IsPropertyList='Y' 
  and adpreferen0_.Property=? 
  and (adpreferen0_.AD_Org_ID in ('0'))
  and (adpreferen0_.AD_Client_ID in ('0')) 
  and adpreferen0_.IsActive='Y' 
  order by adpreferen0_.AD_Preference_ID


---
[1] https://code.openbravo.com/erp/devel/pi/file/c77412df1f7e/src/org/openbravo/erpCommon/businessUtility/Preferences.java#l455 [^]
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0037130 closedmarvintm Retail Modules Terminal authentication is being activated even if the preference is set to 'N' 
related to defect 0038655 closedalostale Openbravo ERP incorrect query in UserLock 
blocks feature request 0037064 closedcaristu Openbravo ERP upgrade hibernate 
blocks defect 0037324 closedalostale Openbravo ERP slow login having many preferences 

-  Notes
(0099958)
hgbot (developer)
2017-10-19 10:49

Repository: erp/devel/pi
Changeset: 27acf774fde2f2ef8ca8d60c27f5b522db6e43e3
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Oct 19 10:25:31 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/27acf774fde2f2ef8ca8d60c27f5b522db6e43e3 [^]

fixed bug 37112: incorrect HQL to retrieve preferences

  Removed extra unbalanced parentheses when organization parameter is null.

---
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
---
(0100094)
caristu (developer)
2017-10-27 10:27

Code reviewed + tested OK.
(0101338)
hudsonbot (developer)
2018-01-03 12:38

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/c81e0d3cbab5 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-10-19 10:21 alostale New Issue
2017-10-19 10:21 alostale Assigned To => platform
2017-10-19 10:21 alostale Modules => Core
2017-10-19 10:21 alostale Triggers an Emergency Pack => No
2017-10-19 10:22 alostale Assigned To platform => alostale
2017-10-19 10:32 alostale Relationship added blocks 0037064
2017-10-19 10:36 alostale Review Assigned To => caristu
2017-10-19 10:36 alostale Summary incorrect HQL in Preferences => incorrect HQL to retrieve preferences
2017-10-19 10:36 alostale Steps to Reproduce Updated View Revisions
2017-10-19 10:49 hgbot Checkin
2017-10-19 10:49 hgbot Note Added: 0099958
2017-10-19 10:49 hgbot Status new => resolved
2017-10-19 10:49 hgbot Resolution open => fixed
2017-10-19 10:49 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/27acf774fde2f2ef8ca8d60c27f5b522db6e43e3 [^]
2017-10-20 10:21 marvintm Relationship added related to 0037130
2017-10-27 10:27 caristu Note Added: 0100094
2017-10-27 10:27 caristu Status resolved => closed
2017-10-27 10:27 caristu Fixed in Version => 3.0PR18Q1
2017-11-20 12:12 alostale Relationship added blocks 0037324
2018-01-03 12:38 hudsonbot Checkin
2018-01-03 12:38 hudsonbot Note Added: 0101338
2018-05-30 10:28 alostale Relationship added related to 0038655


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker