Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何计算正文长度在 0 到 25 个字符之间的消息数量?
Message.countBy('from Message m where m.body.length <= 25')
对我来说不幸的是,countBy它不带字符串参数。
countBy
查看动态方法参考,您可能做的最好的事情就是使用executeQuery而不是count*:
executeQuery
count*
Message.executeQuery('select count(m) from Message m where SIZE(m.body) < 25')
编辑:这里有几个链接可能有助于编写/执行查询: