• 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

Injecting an EntityManager

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

When I want to inject an EntityManager, I use the PersistenceContext annotation with the name element that points to the JNDI entry name where the EntityManager is found.

Does this mean that the application deployer must create JNDI entries for the name provided by the annotation before the application starts. And what happens when the unitName is not specified???

Thanks in advance
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the EJB container takes care of creating the JNDI entries as a part of the Enterprise Naming Context for the bean.
Regarding your second query, if the persistent unit name is not specified, I think the default pesistent unit is assumed(which should be the only PU defined for the application). If more than one PU is defined the you get



and then it is mandatory to priovide unit name.
 
reply
    Bookmark Topic Watch Topic
  • New Topic