Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Data 1.11.7 No property existsBy

Good morning!

My Spring application doesn't seem to detect existsBy projections

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property existsById found for type Planet!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:77)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:329)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:309)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:272)

Code in the repository

public boolean existsByIdAndOwnerId(Long planetId, Integer ownerId);

  • Spring version: 4.3.12.RELEASE
  • Hibernate version: 5.2.12.Final
  • Spring Data JPA version: 1.11.7.RELEASE

Thanks in advance!

like image 619
Kevin Guanche Darias Avatar asked Nov 15 '17 11:11

Kevin Guanche Darias


Video Answer


1 Answers

Try naming the method: existsPlanetByIdAndOwnerId()

This link may help: https://www.baeldung.com/spring-data-derived-queries

like image 143
Jack Straw Avatar answered Oct 16 '22 22:10

Jack Straw