Search code examples
quarkusquarkus-panache

delete in list via Panache in Quarkus


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?


Solution

  • It works with Panache

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