I'm using the following criteria to retrieve all Person
objects that have certain roles granted (in the PersonService
):
@Transactional(readOnly = true)
List findAllByRoles(authorities) {
Person.createCriteria().list {
personRoles {
role {
'in'('authority', authorities)
}
}
order('name', 'asc')
}.unique(false)
}
I now have the problem that it returns a List
with Person__$$__javassist_67
objects rather than Person
objects.
How could I alter the statement in order to retrieve Person
objects?
EDIT:
I need this because I'm using the list I get here in connection with another list of Person
objects. As I wanted to use removeAll
on one of the two lists both need to contain objects of the same type what was not the case.
Implement the equals
method on Person
to be able to identify if 2 instances are equal, which will work across proxy