Setting a parameter as a list for an IN expression

前端 未结 9 2511
北荒
北荒 2020-11-30 07:14

Whenever I try to set a list as a parameter for use in an IN expression I get an Illegal argument exception. Various posts on the internet seem to indicate that this is poss

9条回答
  •  长情又很酷
    2020-11-30 08:04

    Your JPQL is invalid, remove the brackets

    List logins = em.createQuery("SELECT a.accountManager.loginName " +
        "FROM Account a " +
        "WHERE a.id IN :ids")
        .setParameter("ids",Arrays.asList(new Long(1000100), new Long(1000110)))
        .getResultList();
    

提交回复
热议问题