카테고리 없음

[내일배움캠프] 2월 2일 목요일 TIL 회고록

tft4rollz 2023. 2. 2. 22:40

강의를 보면서 테스트 코드를 작성하고 실행했는데 오류가 출력되었다.

오류 내용이 길어서 차근차근 보던 중 No property 'findNameAll' found for type 'User' 라는 오류가 출력된 것을 보고

이거 때문인거 같았다.

강의에서 튜터님이 보여주신 대로 따라했는데...

먼저 인터페이스 MyRepository에 findNameAll을 만들고

  List<String> findNameAll();
}

MyUserRepositoryImpl에 findNameAll() 메서드를 구현했다.

@Override
public List<String> findNameAll() {
  return entityManager.createQuery("SELECT u.username FROM User AS u", String.class)
      .getResultList();
}

그리고 UserRepository에 MyRepository를 추가했다.

public interface UserRepository extends JpaRepository<User, Long>, MyRepository<User>

강의를 그대로 따라했는데 오류가 난다.. 어떻게든 고쳐보려고 했는데 안고쳐진다 ㅠㅠ

구글링을 해도 나오지도 않는다. 내일 한번 더 고쳐봐야되겠다..