我的Spring数据查询是:
@Query("FROM NewsFeed nf where dealRoom.id =:dealRoomId and (fileFolder IN :folders or file in :files)")
Page<NewsFeed> findByFolder(@Param("dealRoomId") final String dealRoomId, @Param("files") final List<File> files, @Param("folders") final List<FileFolder> folders, final Pageable pageable);
但我接受:
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: {vector} [select count(nf) FROM NewsFeed nf where dealRoom.id =:dealRoomId and (fileFolder IN (:folders_0_, :folders_1_, :folders_2_, :folders_3_, :folders_4_, :folders_5_, :folders_6_, :folders_7_, :folders_8_, :folders_9_) or file in :files_0_, :files_1_, :files_2_, :files_3_, :files_4_, :files_5_, :files_6_, :files_7_, :files_8_, :files_9_, :files_10_, :files_11_)]
有谁知道我为什么要使用QuerySyntaxException?
答案 0 :(得分:1)
问题在于第二个IN
子句正在生成错误的sql(值没有用括号括起来):
file in :files_0_, :files_1_, :files_2_
这是hibernate中公认的错误,似乎修复了5.0.7 HHH-9630