Вопрос

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