• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One of more persistence context for separate projects?

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

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?
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try @PersistenceContext annotation. This annotation will inject EntityManager in your session ejb.
 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic