public interface MemberRepository extends JpaRepository<Member, Long> { List<Member> findByUsernameAndAgeGreaterThan(String username, int age);
@Query("select m from Member m where m.username = :username and m.age = :age") List<Member> findUser(@Param("username") String username, @Param("age") int age);
@Query("select m.username from Member m") List<String> findUsernameList();
@Query("select new com.example.datajpa.dto.MemberDto( m.id, m.username, t.name)from Member m join m.team t") List<MemberDto> findMemberByDto();
@Query("select m from Member m where m.username in :names") List<Member> findByNames(@Param("names") Collection<String> names);
List<Member> findListByUsername(String username); Member findMemberByUsername(String username); Optional<Member> findOptionalByUsername(String useranme); }
|