I develop a pack of applications that use the same database. In order to get all the applications using same entity manager I have created just one persistence.xml file, in my entity beans project. Then I created session beans project and attached entity beans as library. The same I did in seam web application. Now I am bit confused, because entity manager is injected correctly in seam application, but is always null in session beans... I mean, I want to use in web app session bean, I create/inject/annotate (@In,@EJB) and all the time entity manager in session bean is null...
All the tutorials are so simple, just saying how to work inside one project... Could anyone help me with this one?
Try @PersistenceContext annotation. This annotation will inject EntityManager in your session ejb.
Joined: Mar 14, 2006
Srivastava Gaurav wrote:Try @PersistenceContext annotation. This annotation will inject EntityManager in your session ejb.
unfortunately entity manager is always null when I try to use session bean in my web application :/ And for sure bean can find persistence unit as deploys without problems. I think I instatate bean in wrong way in my web application (seam), but already tried without luck @In, @EJB or straight with constructing as POJO. Always entity manager is null (and I use @PersistenceContext annotation).
subject: One of more persistence context for separate projects?