Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explanation needed on Session Bean Component Contract

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic