早上好!

我的Spring应用程序似乎无法检测到存在

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)

存储库中的代码
public boolean existsByIdAndOwnerId(Long planetId, Integer ownerId);
  • Spring 版本:4.3.12.RELEASE
  • hibernate 版本:5.2.12。最终
  • Spring Data JPA版本:1.11.7.RELEASE

  • 提前致谢!

    最佳答案

    尝试命名方法:existsPlanetByIdAndOwnerId()
    该链接可能有帮助:
    https://www.baeldung.com/spring-data-derived-queries

    10-05 19:02