0
votes

Here’s what I want to do

delete from table where id in list_of_ids

I know Hibernate HQL can do that

Long[] ids = {1L, 2L, 3L};
Query query = session.createQuery("delete from SysMenu where id in (:id)");
query.setParameterList("id", ids);
int i = query.executeUpdate();

But what can I do if I want to use Panache-ORM?

2

2 Answers

0
votes

with panache you can always use a simplified query, something like

SysMenu.delete("delete from SysMenu where id in ?", ids);

should work (handwritten, not tested).

Here you can see the method definition

0
votes

It works with Panache

Long[] ids = {1414151951951728640L, 1414152114971742208L};
List<Long> list = Arrays.asList(ids);
long rows = SysMenu.delete("id in (?1)", list);