繁体   English   中英

Spring Data JPA-两个IN子句和一个OR-QuerySyntaxException

[英]Spring Data JPA - two IN clause and one OR - QuerySyntaxException

我的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修复。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM