How entity manager is injected from localcontainerEntityManagerFactoryBean

2.3k Views Asked by At

I was searching for how entity manager is injected into DAO classes when I configure LocalContainerEntityManagerFactoryBean class in spring.

class OrderDAOImpl {

   @PersistenceContext
   private EntityManager entityManager

   //....DAO Methods...
}

<bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

.....
</bean>

From this bean, how spring creates entityManager.

I was searching the same reason for hibernate's session factory and I found Here that getObject method will inject sessionFactory. But same is not the case with LocalContainerEntityManagerFactoryBean. Can some one please help me understand how this entityManager is injected in JPA?

0

There are 0 best solutions below