This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

share entitymanager between sessionbeans (jpa)  RSS feed

 
Chris Palau
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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 Ejb application.

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 ?

Thanks

Chris
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!