我的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?

最佳答案

问题出在第二个IN子句中,该子句生成错误的sql(值未用括号括起来):

file in :files_0_, :files_1_, :files_2_


这是冬眠中公认的错误,似乎已在5.0.7 HHH-9630中修复。

07-26 09:27