File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Explanation needed on Session Bean Component Contract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Explanation needed on Session Bean Component Contract" Watch "Explanation needed on Session Bean Component Contract" New topic
Author

Explanation needed on Session Bean Component Contract

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

Source :EJB 3.1 Specification


4.Session Bean Component Contract
4.3 Protocol Between a Session Bean Instance and its Container
Containers themselves make no actual service demands on the session bean instances. The container
makes calls on a bean instance to provide it with access to container services and to deliver notifications
issued by the container.


The first line under " Protocol Between a Session Bean Instance and its Container" says that "Containers themselves make no actual service demands on the session bean instance".
However,the second line of the same paragraph says that "The container makes calls on a bean instance"

Isn't the second line contradictory to the first ?
Please Help.


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1661
    
  25

Hi Mohitkumar Gupta,

Containers themselves make no actual service demands on the session bean instance
Correct: it are the clients of a Session Bean that request for a service. The clients call business methods exposed by the Business Interface.

The container makes calls on a bean instance
In order to fulfil the service demands the container needs to call the Session Bean instance a couple of times, for instance:
- to inject the TimerService (a container service) or another EJB into the Session Bean
- to call the PostConstruct() callback method after creation of the Session Bean.

But the container will never call a Business Method on the Session Bean by itself.

Regards,
Frits
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

Thanks Frits
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Explanation needed on Session Bean Component Contract