카테고리 없음
[JPA]final private Entitymanger,@Autowired EntityManger vs @PersistenceContext EntityManager
키보드발
2022. 9. 24. 15:25
https://photolens.tech/autowired-vs-persistencecontext-for-entitymanager-bean/
@Autowired vs @PersistenceContext for EntityManager bean
What is the difference between: @Autowired private EntityManager em; versus: @PersistenceContext private EntityManager em; Both options work in my application, but can I break something by using th…
photolens.tech
@PersistenceContext allows you to specify which persistence unit you want to use.
@PersistenceContext는 어떤 영속성 유닛을 사용할지 지정해 줄 수 있고
Your project might have multiple data sources connected to different DBs and @PersistenceContext allows you to say which one you want to operate on
너의 프로젝트가 다른 데이터베이스들과 연결된 여러 종류의 데이터 소스를 가지고 있다면 @PersistenceContext는 너가 원하는 것을 선택하게 해준다.