我正在使用spring和crud存儲庫。一切工作正常,但是當我這樣做查詢:在Spring中使用列表<Long>作爲參數CrudRepository
@Query("select distinct(a) from Attribute a where a.placeGroup.organization.id = ?1 and a.placeGroup.id = ?2 and a.attributeEntity = ?3 and a.id in ?4")
List<Attribute> findAllPlaceAttributesByIds(long organizationId, long groupId,
Attribute.AttributeEntity type, Iterable<Long> ids);
我有休耕例外:
Caused by: java.lang.IllegalArgumentException: Parameter value element [4] did not match expected type [java.lang.Long]
任何想法我怎麼能解決這個問題?
ids應該是Long不可迭代的 – dharr
很好,但是這應該是List不是1的值 –