If you call MeasurementScheduleManagerRemote.findSchedulesByCriteria() with a criteria based on resource group ID, it fails with java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: expecting "by", found 'WHERE' near line 3, column 131 [SELECT ms FROM org.rhq.core.domain.measurement.MeasurementSchedule ms WHERE ( ms.resource.id IN ( SELECT res.id FROM org.rhq.core.domain.resource.Resource res JOIN res.implicitGroups group WHERE group.id = :resourceGroupId ) )] This is because Hibernate is treating 'group' as the start of a GROUP BY clause rather than an identifier.
Test case to reproduce (connects to localhost:7080 with rhqadmin/rhqadmin)
I can see queries in modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java and modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java which could potentially trigger this. I'm checking whether replacing "group" with "gr" in those two fixes this.
RHQ-533 and RHQ-2246 have similar QuerySyntaxException results, although caused by different errors.
Patch for this problem. The previously attached testcase throws an exception when run against a current build of trunk, but works when this patch is applied.
James, is this associated with a support case?
Yes, IT 353026.
Applied suggested patch. Thanks.
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2462 Imported an attachment (id=368802) Imported an attachment (id=368803)
commit 15c5ab632360523f7ad37112700a1f2220163fb0
QA Verified: Running something like: var c = new MeasurementScheduleCriteria() c.addFilterResourceGroupId(10001) MeasurementScheduleManager.findSchedulesByCriteria(c) ....returns valid results, rather than a sql error
mass move to component = core server
Mass-closure of verified bugs against JON.