Why does this Grails/HQL query with a JOIN return Lists of pairs of domain classes?
Posted
by ?????
on Stack Overflow
See other posts from Stack Overflow
or by ?????
Published on 2010-04-25T03:53:18Z
Indexed on
2010/04/25
4:03 UTC
Read the original article
Hit count: 382
I'm having trouble figuring out how to do a "join" in Groovy/Grails and the return values I get
person = User.get(user.id)
def latestPhotosForUser = PhotoOwner.findAll("FROM PhotoOwner AS a, PhotoStorage AS b WHERE (a.owner=:person AND a.photo = b)", [person:person], [max:3])
latestPhotosForUser isn't a list of PhotoOwners. It's a list of [PhotoOwner, PhotoStorage] pairs. Since I'm doing a PhotoOwner.findAll, I would have expected to see only PhotoOwners.
Am I doing something wrong, or is this the proper behavior?
© Stack Overflow or respective owner