2

我在一个使用 EclipseLink 1.1 的项目中,我有一个查询,我要做的显而易见的事情是使用 Where-In 子句,如下所示:


      List<String> things = populateListOfThings(); 
      String queryString = " select s from Stuff s where s.thing in (:things) ";
      Query query = em.createQuery(queryString);
      query.setParameter("things", things);

当然,这是一批新鲜酿造的 FAIL,在运行时会像这样对我发牢骚:

java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter things with expected type of class java.lang.String from query string ....

谷歌搜索表明 EclipseLink 1.1 根本不支持将列表转储到这样的参数中;很公平。人们会如何建议解决这个缺陷?

4

0 回答 0