Is it possible to create a criteria that lists all objects sorted by sope property of their children? For example:
class Post {
User owner
}
Post.withCriteria {
order('owner.registerDate', 'asc')
}
It fails with message: Error 500: org.开发者_如何学编程hibernate.QueryException: could not resolve property: owner.registerDate of: Post
What is the right way to do it?
Thanks in advance.
this isn't supported by grails out of the box but there's a plugin that enables this feature:
See http://grails.org/plugin/gorm-labs
It is possible doing this:
Post.withCriteria {
owner{
order('registerDate', 'asc')
}
}
精彩评论