Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBHome and EJBRemote interface  RSS feed

 
pradeep anandan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do in EJB we have 2 separate interface EJBHome and EJBRemote
Coudn't they be combined in one interface.
 
Paul Done
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's at least two reasons:
  • Home is a factory which is responsible for actually creating/getting the instance of the ejb remote interface - this factory is needed because the real ejb remote implementation may vary depending on location of ejb vs client code, whether dynamic proxies are being used, etc..
  • If the EJB is a stateful session bean as opposed to a stateless session bean, then there may need to be initialisation parameters provided by the client code, before the remote methods can be called (which would influence the behaviour of the remote methods). This wouldn't be an issue for stateless beans.


  • Paul
     
    Simon Brown
    sharp shooter, and author
    Ranch Hand
    Posts: 1913
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Also, you may not want your EJBs to be available remotely - EJB 2.0 introduces the concept of local interfaces.
    Simon
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!