Bug 835955

Summary: dynagroup definition cannot contain both plugin configuration and resource configuration expressions
Product: [Other] RHQ Project Reporter: John Sanda <jsanda>
Component: Resource GroupingAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED DUPLICATE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-02 17:24:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Sanda 2012-06-27 16:25:35 UTC
Description of problem:
This issue is related to bug 667896. I want to track it separately though because I think this issue can be resolved independent of 667896. If you attempt to create a dynagroup definition that contains both plugin configuration and resource configuration expressions, an exception is thrown that looks like,

Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Duplicate definition of alias 'simple'

Version-Release number of selected component (if applicable):


How reproducible:
always


Steps to Reproduce:
1. Log into RHQ server
2. Go to create a new dynagroup definition
3. Add a plugin configuration expression, e.g., resource.pluginConfiguration[x] = foo
4. Add a resource configuration expression, e.g., resource.resourceConfiguration[y] = bar
5. Click the "Save and Recalculate" button
  
Actual results:
Exception is thrown and reported in server in message center. The error in the message center is something like:

org.hibernate.hql.ast.QuerySyntaxException:Duplicate definition of alias 'simple' [SELECT res.id FROM org.rhq.core.domain.resource.Resource res JOIN res.childResources child JOIN res.pluginConfiguration pluginConf, org.rhq.core.domain.configuration.PropertySimple simple, org.rhq.core.domain.configuration.definition.PropertyDefinition simpleDef JOIN res.resourceType.pluginConfigurationDefinition pluginConfDef JOIN child.resourceConfiguration conf, org.rhq.core.domain.configuration.PropertySimple simple, org.rhq.core.domain.configuration.definition.PropertyDefinition simpleDef JOIN child.resourceType.resourceConfigurationDefinition confDef WHERE simple.name LIKE :arg3 ESCAPE '\' AND simple.stringValue = :arg4 AND res.inventoryStatus = org.rhq.core.domain.resource.InventoryStatus.COMMITTED AND simple.configuration = pluginConf AND simpleDef.configurationDefinition = pluginConfDef AND simple.name = simpleDef.name AND simpleDef.type != 'PASSWORD' AND simple.configuration = conf AND simpleDef.configurationDefinition = confDef]

Expected results:
A valid JPQL query should be generated.

Additional info:

Comment 1 John Sanda 2012-07-02 17:24:32 UTC
It turns out that this really is the same issue as in bug 667896. Even though we are dealing with different expression types, we are querying the same set tables. I am going to close this as a duplicate.

*** This bug has been marked as a duplicate of bug 667896 ***