• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Entity Bean

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Suggestions invited regarding

(1) How to decide whether we need a local or remote EJB Object . and what are the requirements for using the EjbLocalObject instead of EjbObject

(2) While providing the implementation of methods defined in the component interface methos in the Bean class , can we declare the methods to be protected because they are ownly sub-classed by the EJBObject created by the container.

Cheers
Param
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Param,
You can find some useful information in the J2EE 1.4 Tutorial:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
Chapter 23: Enterprise Beans
Deciding on Remote or Local Access


Whether to allow local or remote access depends on the following factors.

  • Container-managed relationships: If an entity bean is the target of a container-managed relationship, it must use local access.
  • Tight or loose coupling of related beans: Tightly coupled beans depend on one another. For example, a completed sales order must have one or more line items, which cannot exist without the order to which they belong. The OrderBean and LineItemBean entity beans that model this relationship are tightly coupled. Tightly coupled beans are good candidates for local access. Because they fit together as a logical unit, they probably call each other often and would benefit from the increased performance that is possible with local access.
  • Type of client: If an enterprise bean is accessed by application clients, then it should allow remote access. In a production environment, these clients almost always run on different machines than the Application Server does. If an enterprise bean's clients are web components or other enterprise beans, then the type of access depends on how you want to distribute your components.
  • Component distribution: J2EE applications are scalable because their server-side components can be distributed across multiple machines. In a distributed application, for example, the web components may run on a different server than do the enterprise beans they access. In this distributed scenario, the enterprise beans should allow remote access.
  • Performance: Because of factors such as network latency, remote calls may be slower than local calls. On the other hand, if you distribute components among different servers, you might improve the application's overall performance. Both of these statements are generalizations; actual performance can vary in different operational environments. Nevertheless, you should keep in mind how your application design might affect performance.


  • If you aren't sure which type of access an enterprise bean should have, then choose remote access. This decision gives you more flexibility. In the future you can distribute your components to accommodate growing demands on your application.

    Although it is uncommon, it is possible for an enterprise bean to allow both remote and local access. Such a bean would require both remote and local interfaces.

    Also check the EJB 2.1 Specs, Section 5.4 (Choosing between a local or remote client view), Page 55 for further details.


    As for the bean component interface, the clients use a reference of the component interface type to access the bean methods, even if the real object is something implemented by the container. So if you declare the methods visibility to be protected, they will no longer be able to access the bean functionalities.

    Regards,
    [ July 13, 2005: Message edited by: Nadeem Awad ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic