【发布时间】:2015-05-27 04:37:07
【问题描述】:
当我运行这个查询时:
String queryF = "SELECT c FROM CatRoles c WHERE c.rol IN :roles OR :roles IS NULL)";
Query q = entityManager.createQuery(queryF);
List<String> lstRoles = Arrays.asList("EMPLEADO","ADMINISTRADOR");
q.setParameter("roles", lstRoles);
List<CatRoles> actual = q.getResultList();
抛出以下错误:
原因:org.hibernate.exception.DataException:无法提取 ResultSet 在 org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:135) [hibernate-core-4.2.14.SP1-redhat-1.jar:4.2.14.SP1-redhat-1]
但是当我在 Oracle SQL developer 中运行查询时运行良好,查询的目标是,当我发送角色列表时,只部署那些希望在部署完整目录时发送 null 的角色。
【问题讨论】: