I'm trying to get all User
s that follow a certain criteria and have ROLE_USER
.
Criteria:
ArrayList<User> users = User.createCriteria().list() {
inList("gender", whichGenderList)
ne("uid", uid)
profile {
inList("age", whichAge)
}
firstResult(usersPerPage * currentPage)
maxResults(usersPerPage)
}
Question:
Is it possible to add to this criteria a condition that will select only the users with ROLE_USER
?
I'm using:
- Grails 2.4.4
- Spring Security Core 2.0-RC4
Update:
Minimal User
Table:
Role
Table:
UserRole
Table:
eq("role","ROLE_USER")
– Suganthan Madhavan Pillaicould not resolve property: role of: foo.User
. – Daddy Pumpkindomain model
, I think only mapping is enough – Suganthan Madhavan Pillai