使用Spring数据JPA,我试图让这种查询(这是比较复杂的,这是一个简单的例子)传递列表<Integer>春季数据JPA本机查询
@Query(nativeQuery = true,
value = "SELECT * FROM events WHERE typeId IN (?1)")
List<Event> findEventsByType(List<Integer> types);
当我启动查询,异常引发:
org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
我试图名单<整数>整数[],[对象]和字符串,但它是不工作...
我不能传值列表?
哪种做这种查询的最佳方法是?
谢谢!
这是一个相当古老的帖子,但你是否设法解决这个问题? –