hi folks, in page 108 in HF EJB, I went through the solution that Kathy provided for that Exercise where it's eplained that there can be multiple clients accessing the same entity bean at the same time. i was thinking that only a client can have an access or can reference any beant at a time. can you please explain me? i am totally confused. thanks.
think this was from a entity bean home u pass primary key and there already exist a bean on the server. So container generates a handle and object by associating it with the same bean created in the JVM. And you get that handle to the bean which is accessed by so many client at a time. Steve
SCJP1.4,SCWCD, SCBCD, SCEA part 1<br />"Its feels good to know the stuff in detail."
Hi Namaste: The way I understand it is this. For each entity bean there will only be one corresponding EJB object. If a client executes a find method and there is an already EJB object for that entity the client will be given a handle to this EJB object. This does not mean that multiple clients will be accessing the bean at the same time but that they all have a handle to the same EJB object. I believe that the container will control client access to the bean, by synchronizing access to it. The result is increased scalability. One EJB object can service multiple clients.
Hope this answers your question.
[ December 12, 2003: Message edited by: Keith Rosenfield ] [ December 12, 2003: Message edited by: Keith Rosenfield ]
i found the following in page 108 in spec where it says - "Multiple clients can access an entity object concurrently. The container in which the entity bean is deployed properly synchronizes access to the entity object's state using transactions." which means if i am not wrong if there is an object or an bean representing, say,(#40, Fred) and clients A, B and C, then all clients A, B and C can access the bean representing (#40, Fred) at the same time(concurrently). but i am wondering if clien A is working with the bean, how can other clients B and C can access that bean at the same time? can you please point out what i am missing here? thanks.
Hey Namaste: I a bit confused on this concept myself but this is my current understanding. I'm not sure what the spec means by "concurrently". Because it goes on to say that access is synchronized using transactions. This means that if client X is currently executing a method of a bean in a transaction context and client Y wants to execute a method of the bean it will have to wait until the transaction that client X has initiated has completed. So it seems that it would not truely be concurrent. I will do more research on this subject and if I learn anything that will help make it clearer I will share it with you. [ December 13, 2003: Message edited by: Keith Rosenfield ]
Hi all, I think Keith is right in all he wrote above, as far as you replace any "handle" occurence by a "stub" one.
Namaste: i was thinking that only a client can have an access or can reference any beant at a time.
As I understand it : STATELESS = each client gets its own EJBObject, to which she has an exclusive access. But as the EJBObject/bean link is transient (just for the time a bean is out of the pool, serving a business method), clients have an exclusive access to some bean only for the time of a business method. STATEFUL = same, but the EJBObject/bean link is permanent : one client = one EJBObject = 1 bean (the same all the time) ENTITY = transient EJBObject/bean link, with one EJBObject per primary key. For a given entity (and a given primary key value), all clients share the same EJBObject. Access to it serialized (or sort of). Best, Phil.