簡體   English   中英

JPA查詢和,或使用

[英]Jpa query and, or using

我寫了一個查詢,但此查詢返回此錯誤。您有任何想法嗎?我猜我由於括號而收到此錯誤

 @Query("select u from Context u where u.user.id <> :userId and u.publicWatch = 1 and  u.isDeleted = 0 and (u.contextType.id  IN :contextTypeId  or u.status IN :status)")
Page<Context> findFilteredContexts(@Param("userId") Long userId,@Param("contextTypeId") List<Long> contextTypeId,@Param("status") List<String> status, Pageable pageable);

錯誤:

造成原因:java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:意外的AST節點:{vector} [從com.huawei.ti.ei.web.domain.Context中選擇count(u) u.user.id <>:userId和u.publicWatch = 1且u.isDeleted = 0以及(u.contextType.id IN(:contextTypeId_0_)或u.status IN:status_0 _ ,: status_1_)]

如果您使用的是較早版本的休眠模式,則必須在IN參數中加上括號(:status)HHH-5126

受影響的版本3.5.1 -3.6,但在評論中也有人報告了較新的版本...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM