【发布时间】:2016-11-07 10:44:52
【问题描述】:
我正在使用 JPA 从带有 in 子句的表中获取结果,但遇到以下异常:
ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Fail to convert to internal representation
PFB 我的代码:
public interface ObjectCommonDao extends JpaRepository<ObjectCommon, Long> {
@Query("select oc from ObjectCommon oc where oc.id in :listObjects")
List<ObjectCommon> getListSelectedObject(@Param("listObjects") List<Long> listSelected);
}
请告诉我如何在上述查询中使用 IN 子句来获取行列表。
【问题讨论】:
-
ObjectCommon 的 'id' 字段是否定义为 Long?
-
发布实体,以及异常的完整堆栈跟踪
-
是的。 ID 字段很长。