[JPA] Repository

1874 단어 JPATILJPA

Query 생성

Method 이름에서 쿼리 생성

public interface UserRepository extends Repository<User, Long> {

  List<User> findByEmailAddressAndLastname(String emailAddress, String lastname);
}

=>
select u from User u where u.emailAddress = ?1 and u.lastname = ?2

Keyword

Reference
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation

https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/jpa.repositories.html

좋은 웹페이지 즐겨찾기