On Tue, 28 Nov 2000 14:42:02 +0530, Rajan Kashyap
<[EMAIL PROTECTED]> wrote:
>        Can you elaborate a bit more on the process that EJBObjects are not created
>as a part of findBy<Something>() then when are these objects created. I mean
>when we get a collection of objects at the client-end and we call some
>business method on one of the elements from the collection, in this process
>where exactly the EJBObject is created.

<vendor>
I can't speak for Dave/Sybase, but I can tell you what happens in JBoss,
and I suspect Sybase is similar.

When you get a collection of EJBObjects from a finder invocation, there
are no objects created on the server.

When you call an EJBObject from that collection, there is still no
object !matching that particular EJBObject! on the server.

Why? Because in our case there is only one object that handles all of
the invocations. It has a method that looks something like this:
Object invoke(Object pk, Method method, Object[] parameters);

So, when you call the method doStuff("bar") on the EJBObject for your
Person Entitybean which has the primary key "1234", invoke on the server
will be called like this:
Object invoke("1234", doStuffMethod, new Object[] { "bar" });

The container then gets the instance corresponding to "1234" (possibly
activating and loading its db state in the process) and invokes the
"doStuff" method with "bar" as parameter. The result is then returned to
the client. So, at no point was there ever a real EJBObject on the
server. On the client you have something that looks and feels like a
real server EJBObject, but this is merely an illusion. Behind the scenes
there is only one object handling all invocations.

This is why your client can get a million EJBObjects in a collection
without straining the server at all, not memorywise at least.

Note: the above applies to JBoss. I have no idea if the process is
similar for other servers.
Note: for those of you who have read the JBoss source (see jboss.org for
download), yes, the invoke method above has been simplified somewhat,
but the general idea is the same.
</vendor>

/Rickard

--
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to