I have a class called News
. The properties of this domain class are shown below.
String name
String age
Chat chat
I have saved several records in the database for the above class. Now i want to retrieve the first 10000 records of it and display below.
def news = News.createCriteria().list (max: 10000, offset: 5) {
like("chat", Chat.get(chatId)+"%")
}
All what i get is an error :
//groovy.lang.MissingMethodException: No signature of method: com.project.mine.Chat.plus() is applicable for argument types: (java.lang.String) values: [%]
Based on further information in the comments, it would appear you are looking for a criteria something like this:
def news = News.createCriteria().list(max: 10000, offset: 5) {
chat {
eq("chatId", chatId) // assumes that chatId isn't the id of the Chat domain.
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments