Register / Login
EJB and other Java EE Technologies
share entitymanager between sessionbeans (jpa)
posted 7 years ago
I just created a DAO for my web application but I have a big problem.
I have a Generic DAO.
I have an Orders DAO that extends from Generic DAO.
I have a Users DAO that extends from Generic DAO.
All are SessionBeans inside an
Generic DAO throught dependency injection obtains an EntityManager.
The problem is every time I inject Orders Dao it creates an EntityManager but if when I call Users Dao it injects another EntityManager so I lose the session scope of the previous EntityManager.
is there any way to share the same EntityManager on all session Beans ?
Boost this thread!
DOA as session bean ?
EJB3/JPA: problem reloading object with one-to-many
�Session Beans vs Entity Beans�
Injecting a session bean into an application bean
Generic DAO using Spring