Say I want to get book
s by author
s who have "john" in their name. How could I do something like:
Book.createCriteria().list(){
like('author.name', '%john%')
}
Assuming that a Book is related to Author you should be able to do the following:
Book.createCriteria().list() {
author {
like('name', '%john%')
}
}
You can read more about Querying Associations in the documentation.