سؤال

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