简体   繁体   中英

Spring Data JPA - two IN clause and one OR - QuerySyntaxException

My Spring data query is:

@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);

But i take:

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_)]

Does anyone knows why i take QuerySyntaxException?

Problem is with second IN clause which is generating faulty sql (values are not surrounded with parentheses):

file in :files_0_, :files_1_, :files_2_

This was a recognized bug in hibernate, and seems to be fixed for 5.0.7 HHH-9630

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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