4
将IN子句列表添加到JPA查询
我建立了一个NamedQuery,看起来像这样: @NamedQuery(name = "EventLog.viewDatesInclude", query = "SELECT el FROM EventLog el WHERE el.timeMark >= :dateFrom AND " + "el.timeMark <= :dateTo AND " + "el.name IN (:inclList)") 我想做的是用一个项目列表而不是一个项目填充参数:inclList。例如,如果我有一个方法,new List<String>() { "a", "b", "c" }如何在:inclList参数中得到它?它只允许我编入一个字符串。例如: setParameter("inclList", "a") // works setParameter("inclList", "a, b") // does not work setParameter("inclList", "'a', 'b'") // does …