영속성 컨텍스트 정의
영속성 컨텍스트 특징
@PersistenceContext
private EntityManager em;
(...)
private EntityManager em;
@Autowired
public MemberRepository(EntityManager em) {
this.em = em;
}
(...)
최신 Spring Boot 에서는 생략이 가능하다.
private EntityManager em;
public MemberRepository(EntityManager em) {
this.em = em;
}
(...)
@AllArgsConstructor
public class Member {
private EntityManager em;
(...)
}
@RequiredArgsConstructor
public class Member {
private final EntityManager em;
(...)
}