The difference between EJB object and stateless session beans
Joined: Feb 22, 2012
I am new to Enterprise java beans. I am reading "Enterprise JavaBeans 3.1" Oreilly book to learn. I am stuck at a place where I am not able to understand what the author mean to say regarding Stateless and Stateful session beans. The statement is
Stateless session beans
"Once an instance is in the Method-Ready Pool, it is ready to service client requests. When a client invokes a business method on an EJB object, the method call is delegated to any available instance in the Method-Ready Pool. While the instance is executing the request, it is unavailable for use by other EJB objects. Once the instance has finished, it is immediately available to any EJB object that needs it. Stateless session instances are dedicated to an EJB object only for the duration of a single method call."
Stateful session beans
"Each SFSB is dedicated to one client for the life of the bean instance; it acts on behalf of that client as its agent. Stateful session beans are not swapped among EJB objects, nor are they kept in an instance pool like their stateless session counterparts. Once a stateful session bean is instantiated and assigned to an EJB object, it is dedicated to that EJB object for its entire lifecycle."
I am not able to understand
What the term EJB object mean?
What is difference between EJB object and Stateless session instance or Stateful session instance?
Joined: Mar 17, 2012
From their terminology the EJB object is something that the client has and that the client makes the EJB call on so it's just a reference to the EJB, typically of the EJB's interface type.
problem with beginners is they start to learn with the EJB3.1v it's the abstraction level of older EJB older version so it is hard to learn by themselves, because most the books are written for one has previous knowledge of older version of EJB. your questions which are basics of the EJB, so if i give answer here, once again it seems for you like iron peanuts.... so for beginners should have the good resource to learn the EJB. to i recommend you to go through the this article A beginner's guide to EJB and i recommend to refer the EJB 3 in action book, there are minimal differences b/w EJB 3 and EJB 3.1, once you comfortable with EJB 3 you can easily switch to EJB 3.1 in matter of time..
Joined: Feb 22, 2012
Thank you guys for the reply. Now I understood the term EJB object.