This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB Context Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJB Context" Watch "EJB Context" New topic
Author

EJB Context

Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
Will each EJB instance have its own EJB context object?


<i><br />Sun Certified Programmer for Java 2 Platform (SCJP)<br />Sun Certified Developer for Java 2 Platform (SCJD)<br />Sun Certified Web Component Developer for Java2 Platform, Enterprise Edition (SCWCD)<br />Sun Certified Business Component Developer for Java2 Platform, Enterprise Edition (SCBCD)<br />Sun Certified Enterprise Architect for J2EE (SCEA)<br />IBM Certified Enterprise Developer, WebSphere Studio V5.0<br /></i>
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148
yes
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1112

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 ]
     
    I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
     
    subject: EJB Context
     
    Similar Threads
    HFEJB - getPrimaryKey question
    Question about Transactions in EJB / MDB scenario
    deployment
    what document.pub does?
    Using JNDI lookup to get access to the EJB