Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-RC2
-
Component/s: None
-
Labels:None
Description
using the latest git version
This works :
def mainCategory = Category.findAllByName("main").get(0) def q = User.where { category == mainCategory }.sort("username", "desc") def users = q.list()
This causes an error :
def mainCategory = Category.findAllByName("main").get(0) def q = User.where { username != 'test' && category == mainCategory }.sort("username", "desc") def users = q.list()
Error is :
Class groovy.lang.MissingPropertyException Message No such property: mainCategory for class: grails.gorm.DetachedCriteria
I have created a demo project on github that reproduces this error
https://github.com/cameronbraid/grails-where-query-parameterised
Look at the DemoController, the index method works, but index2 fails as above
Fixed by https://github.com/SpringSource/grails-data-mapping/commit/f277911ba8cc9a2ebfbc0f5bc6602e76a2c07572