I'm working with Spring + JPA (with hibernate as JPA provider) using services and dao.
I'd like to inject the JPA EntityManager
in both service and dao, with the service managing the transactions and the dao managing the object persistence.
The dao is @Autowired
in the service and the EntityManager
is injected both in Service and Dao, with @Autowired
.
In this way am I guaranteed to inject the same EntityManager
both in the Service and in the dao ?