Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

How to get a handle for an EJB ?

Thread view: 
gk - 24 Oct 2006 20:24 GMT
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/ejb/EJBHome.html

void     remove(Handle handle)
         Remove an EJB object identified by its handle.

i see there is a handle for a EJB passed into remove() method ?

Question is, How to get a handle for an EJB ?

How does a client  would find out a handle for an EJB ?
Manish Pandit - 24 Oct 2006 21:20 GMT
> Question is, How to get a handle for an EJB ?
>
> How does a client  would find out a handle for an EJB ?

You can do a getHandle() on the EJB instance.

-cheers,
Manish
gk - 24 Oct 2006 21:24 GMT
> > Question is, How to get a handle for an EJB ?
> >
[quoted text clipped - 4 lines]
> -cheers,
> Manish

what do you mean by EJB instance here ?

remote interface ?
home interface ?

client can not get hold of EJB directly , so i am not clear what do you
mean by EJB instance here ? please explain more

thank you
Manish Pandit - 24 Oct 2006 21:37 GMT
In order to use an EJB, I believe these are the steps you are following
(assuming server side code is all deployed and happy)

1. JNDI lookup to get the home interface (which can be local or remote)
2. narrow the reference to home interface if it is remote
3. call create() on the home interface reference to get the
remote/local interface
4. Whatever you receive after 3, the one on which you actually invoke
business methods is what you can call getHandle() on. It implements
EJBObject interface and it is not the actual bean that is there on the
server, but kind of a proxy to it.

Hope this is clear now :)

-cheers,
Manish
gk - 25 Oct 2006 10:37 GMT
> In order to use an EJB, I believe these are the steps you are following
> (assuming server side code is all deployed and happy)
[quoted text clipped - 12 lines]
> -cheers,
> Manish

yes ...its clear now.

thanks

i have  question on your comments though.

you mentioned ,
"narrow the reference to home interface if it is remote"

I think , in EJB 2.0 we dont need to narrow it  ...we dont need to use
portableremoteobject.narrow() method .we will do the direct casting to
home interface....am i right ?  we do it for EJB 1.1
Manish Pandit - 25 Oct 2006 18:27 GMT
Hi,

You have to narrow the reference as long as it is *remote*. The
narrowing concept is carried forward from the CORBA days, and anything
dealing with IIOP has to be narrowed. You do not need the narrow() step
if you are dealing with local interfaces (inter-JVM).

-cheers,
Manish
gk - 26 Oct 2006 11:14 GMT
Thank you Manish.
it was very much helpful.

> Hi,
>
[quoted text clipped - 5 lines]
> -cheers,
> Manish


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.