• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Context

 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will each EJB instance have its own EJB context object?
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Edy,
An EJB consists of three classes:
  • home interface
  • remote interface
  • bean implementation

  • If your bean is a session bean, then it must implement the SessionBean interface. This interface has the "setSessionContext()" method.
    Likewise, if your bean is an entity bean, it must implement the EntityBean interface. This interface has the "setEntityContext()" method.
    Since you are providing the implementation for these interfaces, you can do what you want. You may choose to provide empty implementations for these methods. In that case, your beans will _not_ have their own EJB context object (assuming I am correctly interpreting your question :-)
    So, in my opinion, the answer to your question is a resounding, "it depends".
    (Which is probably the most common answer to questions like yours ;-)
    Hope this has helped you.
    Good Luck,
    Avi.
    [ June 01, 2003: Message edited by: Avi Abrami ]
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!