• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNDI Lookup code for EntityMananger inside SessionBean

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am using JNDI look up inside my stateless session Bean for Thread Safety issues .

That is

@PersistenceContext(Unitname="someunit" name= "somename")

Context ctx = new InitialContext();

EntityManager em = (EntityManager)ctx.lookup("somename")


Now i am having 4 methods for (CRUD) inside my sessionBean

Do i need to use this lookup code inside my every method that is in all my 4 methods

Please tell me this if i am having four methods inside my Session Bean do i need to do lookup inside each of my method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic