
[ 공식 문서 ]
https://docs.spring.io/spring-data/jpa/reference/jpa/query-methods.html
[ JPARepository의 쿼리 메서드 ]

findByUsernameAndPassword를 사용한 모습

이름만 이런 규칙을 정해서 메서드를 만들면 알아서 이런 쿼리를 creation해줌! 그러나 추천하진 않음. 그냥 JPQL로 쿼리 적어라! 간단한건 써도 되는데, 쿼리 크리에이션으로 만들려고 하면 머리 터짐... 누군가가 메소드 이름만 적어놨는데 쿼리가 발동했다?! 아 이건 쿼리 메서드구나~ 라는걸 알라고 보여주신 것 만약, 쓰고 싶으면 딱 이것만 사용해라. -> findByUsername / findByUsernameAndPassword
Share article