Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-RC1
-
Fix Version/s: 2.0-RC2
-
Component/s: None
-
Labels:None
Description
Given the query
Book.where { author.age > avg(author.age) }
Grails currently spits out the compilation error
Cannot use aggregate function avg on property "null" - no such property on class org.example.Author exists
This is no way indicates that you can't use relations in aggregate functions. It just looks like a bug in Grails. The error message either needs improving or relations' properties should be allowed in aggregate functions.
You can use the project attached to GRAILS-8344 for testing. Simply modify the Where query used in BookController.test().
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Fixed by https://github.com/SpringSource/grails-data-mapping/commit/89b857377d9d56a634eb270a474dc252ff48554a