从数据库中检索前10000条记录-grails

从数据库中检索前10000条记录-grails,grails,groovy,Grails,Groovy,我有一门课叫新闻。此域类的属性如下所示 String name String age Chat chat 我已经在数据库中为上述课程保存了几条记录。现在我想检索它的前10000条记录并显示在下面 def news = News.createCriteria().list (max: 10000, offset: 5) { like("chat", Chat.get(chatId)+"%") } 我得到的只是一个错误: //groovy.lang.Missing

我有一门课叫
新闻
。此域类的属性如下所示

String name
String age
Chat chat
我已经在数据库中为上述课程保存了几条记录。现在我想检索它的前10000条记录并显示在下面

    def news = News.createCriteria().list (max: 10000, offset: 5) {
        like("chat", Chat.get(chatId)+"%")
    }
我得到的只是一个错误:

//groovy.lang.MissingMethodException:没有方法的签名: com.project.mine.Chat.plus()适用于参数类型: (java.lang.String)值:[%]


根据评论中的进一步信息,您似乎正在寻找类似以下内容的标准:

def news = News.createCriteria().list(max: 10000, offset: 5) {
  chat {
    eq("chatId", chatId) // assumes that chatId isn't the id of the Chat domain.
  }
}

作为聊天对象的“聊天室”,您如何期待类似的功能?like用于文本/字符串值。您想实现什么?我想检索所有具有相同
chatID
name
chatID
Chat
中的属性)。我该怎么做?