영속성 관리(1)
1. 엔티티 매니저 팩토리와 엔티티 매니저 데이터베이스를 하나만 사용하는 애플리케이션은 일반적으로 EntityManagerFactory를 하나만 생성한다(비용이 비쌈) EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); Persistence.createEntityManagerFactory("hello")를 호출하면 META-INF/persistence.xml에 있는 정보를 바탕으로 EntityManagerFactory를 생성한다. 엔티티 매니저 팩토리가 생성된 후 필요할 때마다 엔티티 매니저를 생성하면 된다.(비용이 거의 안 든다) EntityManager entityManager = emf.createEntityMana..
2023.12.28