I use a GORM criteria to retrieve a list of Spring Security users with filtering and sorting on the properties of the user, and I would like to sort on the spring security role affected to each user. Normally, I could simply do something like this :
User.createCriteria() {
[...]
userRoles {
role {
order("code", "asc")
}
}
}
but I can’t do this here since Spring Security doesn’t define associations between User and UserRole and between userRole and Role. I’ve tried to find a way to make a join with UserRole despite the absence of association with User, with no success. I could also define hasMany associations in User and Role, but maybe Spring Security doesn’t do this for a good reason. What would be the better solution in this case ?
Thank you
As far as I know, there is no reason why you shouldn’t add these mappings yourself