如何在ebean和play框架中找到与ID列表匹配的所有记录? [英] How do I find all records matching a list of Ids in ebean and play framework?

查看:105
本文介绍了如何在ebean和play框架中找到与ID列表匹配的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模型类,每个记录都有一个ID.我有一个要从该表中搜索的ID列表.

I have a model class that has an id per record. And I have a list of id's that I want to search from that table.

我是否需要动态构建SQL语句并将其传递给Finder对象,或者有更好的方法吗?

Do I need to build a SQL statement dynamically and pass it to the Finder object or is there a better way of doing it?

推荐答案

尝试使用Expr.in(String propertyName, Collection<?> values)

其他选项是:Expr.in(String propertyName, Object[] values)Expr.in(String propertyName, Query<?> subQuery)

API参考.

这篇关于如何在ebean和play框架中找到与ID列表匹配的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆