gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 09:33:00 27 4
gpt4 key购买 nike

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

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

关于java - Spring Data JPA - 两个 IN 子句和一个 OR - QuerySyntaxException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39247285/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com