EjB - localhome VS home

T

tim

If you are writing a client program and you are not sure whether the
bean is going to be local or remote, how do you go about determining
this in the code?
The examples I see always seem to know to use home or localhome at the
time of the writing.
 
R

Ravi

I think it depends on the how and where the bean is going to be
deployed. From that planning, you can determin wheather it is a
localhome or hime
 
T

tim

So you have to know ahead of time? What if you initially have it local
and then decide to move it to a different machine due to an increase in
activity.
From all of the examples I have seen, the programmer knows whether it
is local or remote but I would think completely redeveloping the
application when you want to move if from local to remote to increase
the capacity seems to go against the scalability claims made regarding
EJBs.
 
T

tim

OK, that's what all the examples seem to show but I thought you may be
able to make it generic in case you change from local to remote at a
later date.
 
A

Adam Maass

If you are writing a client program and you are not sure whether the
bean is going to be local or remote, how do you go about determining
this in the code?
The examples I see always seem to know to use home or localhome at the
time of the writing.

If you really don't know up-front, you're pretty much stuck with home.
 
J

Jon Martin Solaas

OK, that's what all the examples seem to show but I thought you may be
able to make it generic in case you change from local to remote at a
later date.

What's the problem with that? Just have a configuration property in jndi
or prop-file or databasetable and have your code look up the interfaces
accordingly.
 
W

warnasweb

I have a justification, we can use LocalHome when one Entity is
directly communicating with other Entity. and Home when client is
communicate with EJB(Session Bean->Entity Bean)
 
P

Philip Reimer

So you have to know ahead of time? What if you initially have it local
and then decide to move it to a different machine due to an increase in
activity.
is local or remote but I would think completely redeveloping the
application when you want to move if from local to remote to increase
the capacity seems to go against the scalability claims made regarding
EJBs.

Perhaps you can use the ServiceLocator pattern with one method for
looking up remote homes and one for local homes. Than you'd just have to
find/replace one methodname in your code.
 
J

Jon Martin Solaas

warnasweb said:
I have a justification, we can use LocalHome when one Entity is
directly communicating with other Entity. and Home when client is
communicate with EJB(Session Bean->Entity Bean)

If everything is running in the same container local interfaces all over
is more efficient, so by having the Session Bean <-> Entity Bean
interfaces configurable one could achieve better performance in some
situations. For Entity Beans, local interfaces are needed for container
managed relations. Generally, if entity beans need to talk to each other
via remote interfaces on a regular basis, I'd say there is something
wrong with the architecture.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top