스프링 CrudRepository 인터페이스

Jmnote (토론 | 기여)님의 2016년 6월 29일 (수) 11:42 판 (→‎개요)

1 개요

CrudRepository
org.springframework.data.repository.CrudRepository
  • CRUD 기능을 가진 리파지토리
  • 대략 아래와 같이 선언하여 Repository로 사용
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {

}

2 메소드

메소드 설명
count() 개수 확인
delete() 1건 또는 여러 건 삭제
deleteAll() 모두 삭제
exists() ID 있는지 확인
findAll() 전체 또는 ID목록으로 조회
findOne() ID로 조회
save() 1건 또는 여러 건 저장

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}