top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

what is diff between local home and remote home in ejb

+3 votes
what is diff between local home and remote home in ejb
posted Oct 17, 2013 by Tulasi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Tulasi: Your questions could have been Home, Remote, local and localhome for completeness? If yes please complete your question.

1 Answer

+1 vote

Describing all four as per Salil's suggestion -

The Remote and Home interfaces have somewhat misleading names, because both interfaces are used by the EJB client, which may be on a "remote" machine.

You will need to use both when working with EJBs. In very general terms, the Home interface has methods that relate to all EJBs of a certain class as a whole. For example, you will find the create() methods in the Home interface, which create new beans. You'll also see the find() methods, in the case of entity beans, which return handles on certain beans.

The Remote interface has the methods that relate to a particular bean instance. This is usually where all the business methods go. For example, the Remote interface for an entity bean will have all of the "getFoo()", "getBar()" methods that return properties of a particular bean.

In some sense Home interface methods are analagous to the constructor and static methods of a regular Java class, and Remote interface methods are like instance methods of a regular Java class.

The Local and LocalHome interfaces are entirely analagous, but are used to more efficiently access EJBs that are deployed in the same container.

Hope this helps.

answer Oct 17, 2013 by Deepankar Dubey