This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of React Cookbook: Recipes for Mastering the React Framework and have David Griffiths & Dawn Griffiths on-line!
See this thread for details.
Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Why doesn`t my @PersistenceContext & @EJB work???

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

i`m having a bit of a hard day, getting my annotations to work. I`m using glassfish b48.

My EJB3.0 entity`s deploy fine, including a stateless session bean that is accessing these entity beans, i deploy this in a seperate jar.

Then i have a webservice (jax-ws 2.0) that access the session bean and calls the methods on it. (seperate deploy).
When i write all the old jndi lookup code, it works fine.
but not when i use the annotation, aswell as for @PersistenceContext EntityManager em; I can once again get a reference to it if use the EntityManagerFactory emf = Persistence.createEntityManagerFactory("postgres");

even if i specify the unitName in the annotation i cant seem to get hold of the Reference. and this is also my only persistence unit in the app.

o just for safety sake...i can persist and retrieve entity`s if i get a reference to the EntityManager.

Any reason why it doesnt work would help.
Rgds
Derick
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not advanced Java. Moving to EJB and other J2EE Technologies.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you try to use @EJB and the like, you are including the name, right? like

@EJB (name=blahblahblah) Or is the name in quotes?

Mark
 
Derick Potgieter
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the name is in quotes...

has to be as far as i know??
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic