It's not a secret anymore!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Create session bean stateless and stateful??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Create session bean stateless and stateful???" Watch "Create session bean stateless and stateful???" New topic
Author

Create session bean stateless and stateful???

Oelison Sousa
Greenhorn

Joined: Jul 11, 2002
Posts: 9
Hi,
I did not understand because this question is false and true ? they are changed ??

1) The statement is true or false: If a stateless session bean client invokes create() method on the bean's home interface then it is guaranteed that a new stateless session bean instance will be created.

Reply: The statement is false

2) The statement is true or false: If a stateful session bean client invokes create<METHOD>(...) method on the bean's home interface then it is guaranteed that a new stateful session bean instance will be created.

Reply: The statement is true

[ May 12, 2006: Message edited by: Oelison Sousa ]
[ May 12, 2006: Message edited by: Oelison Sousa ]
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
The answers are right.

Unlike the entity bean and stateful session bean, invoking the create() method for stateless bean does not result in a call to the bean's ejbCreate() method. In stateless session beans, calling the EJB home's create() method results in the creation of an EJB object for the client, but that is all. The ejbCreate() method of a stateless session bean is only invoked once in the life cycle of an instance--when it is transitioning from the Does Not Exist state to the Method-Ready Pool. It isn't reinvoked every time a client requests a remote reference to the bean.

[ UD: removed link to copyrighted material ]


[ May 12, 2006: Message edited by: wise owen ]
[ August 03, 2007: Message edited by: Ulf Dittmer ]
Ugender Rekulampally
Ranch Hand

Joined: Nov 14, 2005
Posts: 130
Hi,
When you call create() method on Stateless Session Bean, container wont create a new stateless session bean but it assigns an EJBObject to the client. So the answer is FALSE here.

But with Stateful session bean, when you call create method, the container actually creats a bean with the specied values in the create method's signature. So the answer in this case is TRUE.

Hope this helps.

Ugender Rekulampally.
 
Don't get me started about those stupid light bulbs.
 
subject: Create session bean stateless and stateful???