Instruction in the game using hql

How to write an HQL query, for example, the same SQL query as this:

select * from Users u where u.id in (1, 3, 4)
+5
source share
3 answers

Try User.find("id in (:ids)").bind("ids", new Long[]{1L,3L,4L}).fetch()

0
source

I suggest you use your own query to use your SQL query, so you do not need to convert it to HQL.

0
source

The easiest way to do this with a game is

public static void findByIds(List<Long> userIds) {
    find("from Users u where u.id in (?1)", userIds).fetch();
}
0
source

All Articles