Originally posted by Shreyas Reddy:
I am debating about the answer for the question on page 108 of HFE. These are my answers. Can someone post their opinions/answers.
Thanks,
---------------------------------------------------------
1. "Guaranteed to survive a container crash" --->Doesn't this apply to all types of beans?Stateful session beans state is probably saved somewhere by the container, entity beans has a persistent store, message driven beans dont have the problem.I am doubtful about stateless session beans.
2.Has a client view --> stateful and stateless session beans, entity beans
3.Allows asyn. communiction --> Only Message driven beans
4.Multiple clients can have a ref. tot he same bean --> stateless session bean, entity bean
5. Represents process -> stateful and stateless session beans
6. represents thing -> entity beans
Here are my answers:
1. "Guaranteed to survive a container crash" - Only Entity beans, because they represent persistent entities in the store. Stateless and MDB do not survive, container will recreate them after the crash. I am not sure about statefull, it could depend on the vendor implementation but in general passivation doesn't mean persistance, beans is passivated only when client is inactive but will be destroyed after client times out.
2. "Has a client view" - same, Session and Entity.
3. "Allows asyn. communiction" - same, only MDB.
4. "Multiple clients can have a ref. to the same bean" - only Entity beans. If both clients looks for entity bean #10 they will get reference to the same bean instance. NOT for Stateless bean. Container will associate the bean instance with the
EJB object only for the time for the call.
5. "Represents process" - Statefull, stateless, MDB. MDB is a process too, only asynchronous.
6. same.
Vitaliy