How do I find all records matching a list of Ids in ebean and play framework?

南楼画角 提交于 2019-12-11 06:20:00

问题


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.

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?


回答1:


Try to build a query using Expr.in(String propertyName, Collection<?> values)

Other options are : Expr.in(String propertyName, Object[] values) or Expr.in(String propertyName, Query<?> subQuery)

API reference.



来源:https://stackoverflow.com/questions/16387727/how-do-i-find-all-records-matching-a-list-of-ids-in-ebean-and-play-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!