Is there an equivalent to the native sql !=-operator for Spring Data JPA @Query-Annotation using OpenJPA? So i thought it would work somewhat like this:

@Query("select a from TableA a, TableB b where a.property != b.property")

but it doesn't, or lets say at least my ide (intellij) shows me that it does not know how to work with '!='.

The (as i thought) corresponding

@Query("select a from TableA, TableB b where a.property = b.property")

works.

有帮助吗?

解决方案

In JPQL you should use SQL syntax (for the most part) meaning that != is expressed with <>. See also this wiki article

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top