
JPA 기초 - JPA를 이용한 조회, 수정, 삭제
·
카테고리 없음
본 내용은 유튜브 나무소리님의 강의 내용을 정리한 내용입니다. 1-5강 JPA 기초 실습(3) 엔티티 조회 엔티티를 조회할 때에는 EntityManager의 find() 메서드를 활용합니다. 이 메서드는 두 가지 인자를 받아와서 사용됩니다. 첫 번째 인자는 데이터를 담을 엔티티 객체이며, 두 번째 인자는 조회하고자 하는 데이터의 기본 키 값(PK)입니다. // CustomerJpaExam public static void main(String[] args) { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("customer-exam"); EntityManager entityManager = entityM..