Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: Grails-FilterPane-0.6.6
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Performing a filter on a domain class with associated domain classes. I receive multiple enitities in the result list. I think the problem lies in the outer join that is performed.
In the filter method the following change fixed the problem for me:
} // end criteria
def results = null
if (doCount) {
results = c.get(criteriaClosure)
} else {
results = c.list(criteriaClosure) // change this to c.listDistinct(criteriaClosure)
}
It seems to work, but I'm not sure if there are any side affects.
Ok, the fix that I have proposed is not a good solution.
If it comes to pagination I ran into troubles, but this happens only with the original source coude. The problems lies in the offset and maxResult behaviour of Hibernate. This topic is discussed often enough. So the solution for me is to do a workaround. By filtering the double entries at the controller, for one data 'page'.
The only thing was is to trick the filter pane plugin to count the additional rows which come up by the outer join of hibernate. I have done this by using 'dummy' where clause statements on the joined tables. So the count() returns the 'false' number of rows, but the right number of rows to use the built in pagination.
Sorry, for raising the bug.