• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the need for EJB to get reference to Home interface?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJBContext.getEJBHome()/getEJBLocalHome are used to get ejb home.
Normally client uses home interface to get component interface and stub.

Then why EJB itself needs reference to EJB HOME?

Thanks,
Yamini
 
Me
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by yamini nadella:
... Then why EJB itself needs reference to EJB HOME?


In one word, I would say efficiency.

1. Using home obtained in this way, you can make new beans of this type without doing JNDI lookup.
2. Also, you don't need JNDI lookup information
3. Even if you do have JNDI lookup information, calling getEJBHome() on the bean is more efficient.

See HFEJB page 137

Hope this helps
 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when client get need to create multiple bean of same type? is it for threads?
 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.when client get need to create multiple bean of same type? is it for threads?

Even if you create multiple session/entity beans of the same type from a single thread, you still execute one bean at a time. It is not for threads.

If you submit jobs to a queue/totpic processed by message driven beans, then you can think that it is for threads since each of job can be processed independently.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic