Reputation: 444
we have a User class
class User {
...
}
and another class:
class Licence {
User user
Event event
}
What we want to do is the Left Join (because not for every user we have an entry in the licence class).
We naively did this:
def a = User.withCriteria {
createAlias("Licence", "l", CriteriaSpecification.LEFT_JOIN)
eq("id", "l.user.id")
if (something == true)
isNull("l.id")
else
isNotNull("l.id")
}
But the query fails with:
could not resolve property Licence of User
Can somebody help how to do this query?
Upvotes: 0
Views: 3758