Bug 737121

Summary: sorting by Type, Children, or Descendants column on any group list view with 500 or so total groups causes "org.hibernate.QueryException: could not resolve property: foo of: org.rhq.core.domain.resource.group.ResourceGroup" error
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: Core UIAssignee: Ian Springer <ian.springer>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.1CC: ccrouch, hrupp, skondkar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 19:22:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 678340, 717358    

Description Ian Springer 2011-09-09 16:42:18 UTC
(11:23:14 AM) ips: fyi, i've just discovered a new class of gui bug
(11:23:40 AM) ips: it has to do w/ sorting of datasource bcked grids
(11:25:59 AM) ips: i found it when trying to sort the groups list view by various columns
(11:26:25 AM) ips: when i only had a 100 or so total groups, all of the sort columns worked fine
(11:27:01 AM) ips: but when i had 600 or so total groups, sorting by certain columsn started throwing exceptions
(11:27:44 AM) ips: org.hibernate.QueryException: could not resolve property: availabilityDescendents of: org.rhq.core.domain.resource.group.ResourceGroup
(11:28:30 AM) ips: i believe the reason they worked for the smaller data sets is because smargwt had already fetched the entire data set and so was doing the sorting client-side
(11:29:34 AM) ips: but for the larger data set, it had to do the sorting on the server side, which flushes out issues with the gwt datasource field names not matching up to field names in our criteria queries
(11:30:51 AM) ips: i suspect we'll find this issue on other list views besides the groups list view.
(11:32:18 AM) ips: the test steps are to 1) make sure there are around 500 items total in the list, and then 2) try to sort by each of the columns in the table
(11:44:21 AM) jshaughn: ips, it may also happen when the column is actually not sortable. meaning, the column shows a "computed" value.
(11:44:36 AM) jshaughn: in that case we should probably set the column to canSort(false)
(11:45:06 AM) jshaughn: I'm not sure if there is a way to allow sorting only if the whole result set is resident.
(12:00:49 PM) ips: DataSourceField.setCanSortClientOnly(true) looks promising
(12:01:33 PM) ips: ListGridField has the same method too

---

The field names of the three broken columns are:

Type: typeName
Children: availabilityChildren
Descendants: availabilityDescendents

For Type, there is already a "resourceTypeName" sort override in ResourceGroupCriteria, so we renaming the GWT field to "resourceTypeName" should fix things.

availabilityChildren maps to both resourceGroupComposite.explicitUp and resourceGroupComposite.explicitDown and availabilityDescendents maps to both resourceGroupComposite.implicitUp and resourceGroupComposite.implicitDown,

So we could either set these two GWT fields to sort by the underlying *Up fields and, since they are composite fields, implement that sorting at the SLSB level, rather than at the criteria level; or we could set the GWT fields to setCanSortClientOnly(true).

Comment 1 Ian Springer 2011-09-27 23:43:43 UTC
[master 9d8f5bc] fixes this - the Type column is now fully sortable, and the Children and Descendants are now configured to only do client-side sorting (i.e. sorting is only allowed when the entire data set has been loaded into the client).

http://git.fedorahosted.org/git?p=rhq/rhq.git;a=commit;h=9d8f5bc97d535a3213b56b1bcb28b2be74dab3fe

Comment 2 Sunil Kondkar 2011-09-28 11:42:16 UTC
Verified on build#437 (Version: 4.1.0-SNAPSHOT Build Number: 9d8f5bc)

Created some dynagroup definitions with a saved expression 'Unique resource types in inventory'. So that the all and compatible group list have more than 600 total groups. Sorted by columns 'Type'. The sorting is working and no exception is observed. Sorting was not allowed for columns 'Children' and 'Descendants'.

Right clicked on 'Name' column and grouped by name and then clicked Ungroup. Then verified sorting by columns 'Children' and 'Descendants'. The sorting is working and no exception is observed.

Marking as verified.

Comment 3 Mike Foley 2012-02-07 19:22:38 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE