Bug 535804 (RHQ-2462) - MeasurementScheduleManagerRemote.findSchedulesByCriteria() fails when using resource group ID filtering
Summary: MeasurementScheduleManagerRemote.findSchedulesByCriteria() fails when using r...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: RHQ-2462
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 1.3
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: Jay Shaughnessy
QA Contact: Corey Welton
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard: Branch RHQ_1_3_0_GA_CP
Depends On:
Blocks: JON231
TreeView+ depends on / blocked
 
Reported: 2009-10-12 06:45 UTC by James Livingston
Modified: 2018-10-20 04:29 UTC (History)
2 users (show)

Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-12 16:52:55 UTC
Embargoed:


Attachments (Terms of Use)
TestCase2462.java (942 bytes, text/x-java)
2009-10-12 06:47 UTC, James Livingston
no flags Details
rhq-2462.patch (1.76 KB, text/x-patch)
2009-10-13 01:10 UTC, James Livingston
no flags Details

Description James Livingston 2009-10-12 06:45:00 UTC
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.

Comment 1 James Livingston 2009-10-12 06:47:18 UTC
Test case to reproduce (connects to localhost:7080 with rhqadmin/rhqadmin)

Comment 2 James Livingston 2009-10-12 06:48:58 UTC
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.

Comment 3 James Livingston 2009-10-12 07:12:06 UTC
RHQ-533 and RHQ-2246 have similar QuerySyntaxException results, although caused by different errors.

Comment 4 James Livingston 2009-10-13 01:10:32 UTC
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.

Comment 5 Charles Crouch 2009-10-14 15:20:23 UTC
James, is this associated with a support case?

Comment 6 James Livingston 2009-10-14 22:15:21 UTC
Yes, IT 353026.

Comment 7 Jay Shaughnessy 2009-10-19 21:22:18 UTC
Applied suggested patch. Thanks.

Comment 8 Red Hat Bugzilla 2009-11-10 21:04:54 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2462
Imported an attachment (id=368802)
Imported an attachment (id=368803)


Comment 9 Jay Shaughnessy 2009-12-10 20:03:01 UTC
commit 15c5ab632360523f7ad37112700a1f2220163fb0

Comment 10 Corey Welton 2010-01-27 21:32:12 UTC
QA Verified:  Running something like:

var c = new MeasurementScheduleCriteria() 
c.addFilterResourceGroupId(10001) 
MeasurementScheduleManager.findSchedulesByCriteria(c)

....returns valid results, rather than a sql error

Comment 11 wes hayutin 2010-02-16 21:15:21 UTC
mass move to component = core server

Comment 12 Corey Welton 2010-08-12 16:52:55 UTC
Mass-closure of verified bugs against JON.


Note You need to log in before you can comment on or make changes to this bug.