我试图避免与传递第二个参数法列表大小的冗余。相反,我使用EL,但我有一个错误:为什么规划环境地政司的支持并不在Spring数据JPA @Query工作?
org.hibernate.QueryException: Not all named parameters have been set: [$synthetic$__1] [SELECT distinct b FROM Book b join b.bookHashtags as ht where ht.hashtagName in :tags group by b.uniqueIdentifier having count(ht.uniqueIdentifier) = :$synthetic$__1]
@Repository
public interface BookRepository extends JpaRepository<Book, Long>, JpaSpecificationExecutor<Book> {
@Query("SELECT distinct b FROM Book b join b.bookHashtags as ht where ht.hashtagName in :tags " +
"group by b.uniqueIdentifier having count(ht.uniqueIdentifier) = :#{#tags.size()}")
List<Book> findAllBooksContainedTags(@Param("tags") Set<String> tags);
}
我用弹簧数据的JPA 1.11.0.RELEASE。我知道,这个功能是在1.4版本开发。为什么它不会在我的情况下工作...