是否有与使用 OpenJPA 的 Spring Data JPA @Query-Annotation 的 native sql != 运算符等效的操作?所以我认为它会像这样工作:
@Query("select a from TableA a, TableB b where a.property != b.property")
但事实并非如此,或者至少可以说我的 ide (intellij) 告诉我它不知道如何使用 '!='。
(如我所想)对应
@Query("select a from TableA, TableB b where a.property = b.property")
有效。
最佳答案
在 JPQL 中,您应该使用 SQL 语法(大部分),这意味着 !=
表示为<>
。另请参阅this wiki article
关于java - Spring Data JPA/OpenJPA : Is there an equivalent to SQL ! =-运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20210235/