File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFE - Page 108!! 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 "HFE - Page 108!!" Watch "HFE - Page 108!!" New topic
Author

HFE - Page 108!!

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
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.
Steve Agarwal
Ranch Hand

Joined: Feb 02, 2003
Posts: 51
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."
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Does this mean that it is possible to have only one entity bean instance associated with multiple EJB Objects and used by different clients at the same time?
Looks like I am missing something here.
Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
Steve, I am still not sure if you are saying many clients can access an entity bean at the same time !!! if it can, how?
Keith Rosenfield
Ranch Hand

Joined: Nov 25, 2003
Posts: 277
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 ]

Keith Rosenfield<br />SCJP<br />SCWCD<br />SCBCD
Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
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.
Keith Rosenfield
Ranch Hand

Joined: Nov 25, 2003
Posts: 277
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 ]
Keith Rosenfield
Ranch Hand

Joined: Nov 25, 2003
Posts: 277
This link may be of help.
http://www.jguru.com/faq/view.jsp?EID=35269
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
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.
 
GeeCON Prague 2014
 
subject: HFE - Page 108!!