springjpacrud

JPA repository queries by function name for not equals


I'm trying to write a query by function name available in Spring (JPA). I need something like this select * from table where col1=x AND col2=y AND col3 <> z. Would the following function name be equivalent?

findByCol1AndColb2ndCol3IsNot(....)


Solution

  • findByCol1AndCol2AndCol3Not -> you just need to remove the "Is" . The following page lists all the possible keywords:

    https://docs.spring.io/spring-data/jpa/reference/jpa/query-methods.html#jpa.query-methods.query-creation