HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
✍🏻
Learnary (Learn - Diary)
/
🌪️
Soloving_Issue_Log
/
JPA custom repository 작명

JPA custom repository 작명

생성
Feb 15, 2023 04:52 AM
kindOf
JPA
Status
Done
상황해결

상황

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property '${customRepository method name}' found for type '${entity type}'
 
JPA에서 제공하는 쿼리를 사용하지 않고 커스텀해서 사용하기 위해 해당 구조를 택했다.
그런데 관련 메소드에 프로퍼티가 없다라는 로그를 찍고 애플리케이션이 실행되지 않았다.
notion image
 

해결

이름을 잘 지어야 한다.
  • 관련 자료를 찾아보니 네이밍을 짓는 규칙이 있는 것 같음.
  • 실제로 코드에서 어떻게 읽어오는지 알 수 는 없었음.
 
custom${EntityName}Repsitory ← custom${EntityName}RepositoryImpl
이런식의 구조로 이름을 지어야 함.
또는
${EntityName}CustomRepsitory ← ${EntityName}CustomRepositoryImpl
 
Impl 이름을 쓰지 않으면 해당 예외가 발생하니 주의해야 한다.
 
Spring Data JPA - "No Property Found for Type" Exception
Well, I searched Google and found many results, but none of them was able to answer my problem. So, here it goes. I am trying to study Spring MVC and Spring Data JPA by doing a minimal implementat...
Spring Data JPA - "No Property Found for Type" Exception
https://stackoverflow.com/questions/19583540/spring-data-jpa-no-property-found-for-type-exception/26539097#26539097
Spring Data JPA - "No Property Found for Type" Exception