In Java SE I can create EntityManager instance via EntityManagerFactory and I can create as many as I want. In Spring boot I inject EntityManager via @PersistenceContext. How does it work? Does it mean in is injected only one time only? and what if I close it (like closing a session in hibernate?) how can I re-inject it? (like opening new session or creating new entityManager instance)
Asked
Active
Viewed 90 times
0
-
check this related question and it's answer: https://stackoverflow.com/q/33074547/11065438 – Pushkar Adhikari Mar 04 '19 at 04:37
-
You may want to read about Spring Boot https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jpa-and-spring-data – Simon Martinelli Mar 04 '19 at 12:12