Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0023743Openbravo ERPA. Platformpublic2013-05-06 13:102013-06-04 07:15
dbaz 
shankarb 
highminoralways
closedfixed 
5
 
3.0MP24 
mtaal
Core
No
0023743: OBDal.getInstance().createQuery second parameter 'where' word now must be lowercase
OBDal.getInstance().createQuery second parameter 'where' word now must be lowercase. It is quite strange and it should allow also 'WHERE' uppercase word.
Write some dummy java code like

  String whereClause = " AS project WHERE project.active = 'Y'";
  OBQuery<Project> projectListQuery = OBDal.getInstance().createQuery(Project.class, whereClause);
  List<Project> projectList = projectListQuery.list();

It fails: unexpected token: where near line ...

No tags attached.
Issue History
2013-05-06 13:10dbazNew Issue
2013-05-06 13:10dbazAssigned To => mtaal
2013-05-06 13:10dbazModules => Core
2013-05-06 13:10dbazTriggers an Emergency Pack => No
2013-05-21 09:37shankarbAssigned Tomtaal => shankarb
2013-05-21 10:00shankarbReview Assigned To => AugustoMauch
2013-05-21 10:01shankarbIssue Monitored: AugustoMauch
2013-05-21 10:02shankarbIssue End Monitor: AugustoMauch
2013-05-21 10:02shankarbIssue Monitored: mtaal
2013-05-21 10:03shankarbReview Assigned ToAugustoMauch => mtaal
2013-05-21 10:04hgbotCheckin
2013-05-21 10:04hgbotNote Added: 0058714
2013-05-21 10:04hgbotStatusnew => resolved
2013-05-21 10:04hgbotResolutionopen => fixed
2013-05-21 10:04hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/28d3d4f719c66ccfaa06b0db239db49a11b40939 [^]
2013-05-21 10:09mtaalNote Added: 0058715
2013-05-21 10:11shankarbNote Added: 0058716
2013-05-21 10:55hgbotCheckin
2013-05-21 10:55hgbotNote Added: 0058717
2013-05-21 13:36dbazNote Added: 0058723
2013-05-21 14:11hgbotCheckin
2013-05-21 14:11hgbotNote Added: 0058724
2013-05-21 14:16shankarbNote Added: 0058725
2013-05-21 14:33hgbotCheckin
2013-05-21 14:33hgbotNote Added: 0058726
2013-05-23 01:34hudsonbotCheckin
2013-05-23 01:34hudsonbotNote Added: 0058838
2013-05-23 01:34hudsonbotCheckin
2013-05-23 01:34hudsonbotNote Added: 0058839
2013-05-23 01:34hudsonbotCheckin
2013-05-23 01:34hudsonbotNote Added: 0058842
2013-05-23 01:34hudsonbotCheckin
2013-05-23 01:34hudsonbotNote Added: 0058843
2013-06-04 07:15mtaalNote Added: 0059137
2013-06-04 07:15mtaalStatusresolved => closed
2013-06-04 07:15mtaalFixed in Version => 3.0MP24

Notes
(0058714)
hgbot   
2013-05-21 10:04   
Repository: erp/devel/pi
Changeset: 28d3d4f719c66ccfaa06b0db239db49a11b40939
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Tue May 21 13:28:36 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/28d3d4f719c66ccfaa06b0db239db49a11b40939 [^]

Fixes Issue 0023743: In createQuery second parameter 'where' word now must be lowercase

If the whereClause of OBQuery contains 'WHERE', 'org.hibernate.hql.PARSER - line 1:101: unexpected token: where' error is raised.
Replaced all occurences of 'WHERE' to lowercase in createQueryString method.

---
M src/org/openbravo/dal/service/OBQuery.java
---
(0058715)
mtaal   
2013-05-21 10:09   
Imhv this is a great issue to have a testcase for it in this junit test:
https://code.openbravo.com/erp/devel/pi/file/28d3d4f719c6/src-test/org/openbravo/test/dal/IssuesTest.java [^]

can you add a testcase?

gr. Martin
(0058716)
shankarb   
2013-05-21 10:11   
Sure Martin.
(0058717)
hgbot   
2013-05-21 10:55   
Repository: erp/devel/pi
Changeset: 31353433f34e4fb62a0ec1c94c8feb01dd096b73
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Tue May 21 14:24:39 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/31353433f34e4fb62a0ec1c94c8feb01dd096b73 [^]

Related to Issue 23743 : Added test case

---
M src-test/org/openbravo/test/dal/IssuesTest.java
---
(0058723)
dbaz   
2013-05-21 13:36   
Hi, I would recommend a solution like

qryStr = qryStr.replaceAll(" WHERE ", " where ");

to avoid words like "somewhere" be modified due to this massive replacement.

Just my two cents.

Regards.
(0058724)
hgbot   
2013-05-21 14:11   
Repository: erp/devel/pi
Changeset: d48fd49cb8fe102d362a6ca46202446188b6f1b9
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Tue May 21 17:37:29 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/d48fd49cb8fe102d362a6ca46202446188b6f1b9 [^]

Related to Issue 23743 : Code refactoring

Moved logic from createQueryString to getWhereAndOrderBy method.

---
M src/org/openbravo/dal/service/OBQuery.java
---
(0058725)
shankarb   
2013-05-21 14:16   
Hi David,
Yes that is a case where the code would fail. Thank you.

Shankar
(0058726)
hgbot   
2013-05-21 14:33   
Repository: erp/devel/pi
Changeset: 3efd192fdaae1fca2c0993b83dec3ad0f8f78472
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Tue May 21 17:58:31 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/3efd192fdaae1fca2c0993b83dec3ad0f8f78472 [^]

Related to Issue 23743 : Code Refactoring to replace ' WHERE ' to avoid replacing words like 'SOMEWHERE'

Replaced " WHERE " instead of "WHERE" so that words that has where in it like "SOMEWHERE" are not replaced incorrectly.

---
M src/org/openbravo/dal/service/OBQuery.java
---
(0058838)
hudsonbot   
2013-05-23 01:34   
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/97c7f6256af7 [^]

Maturity status: Test
(0058839)
hudsonbot   
2013-05-23 01:34   
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/97c7f6256af7 [^]

Maturity status: Test
(0058842)
hudsonbot   
2013-05-23 01:34   
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/97c7f6256af7 [^]

Maturity status: Test
(0058843)
hudsonbot   
2013-05-23 01:34   
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/97c7f6256af7 [^]

Maturity status: Test
(0059137)
mtaal   
2013-06-04 07:15   
Reviewed