*
The moose likes EJB and other Java EE Technologies and the fly likes Entity Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Entity Bean" Watch "Entity Bean" New topic
Author

Entity Bean

Param Arr
Greenhorn

Joined: Jan 01, 2005
Posts: 2
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
Nadeem Awad
Ranch Hand

Joined: Jan 09, 2005
Posts: 74
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 ]

    Share Knowledge to gain it.<br /> <br />SCJP 1.2, SCDJWS 1.4, SCWCD 1.4, SCBCD 1.3, ICAD
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Entity Bean
     
    Similar Threads
    Ejb does not implement remote interface.
    Home methods
    non remote expection in beans
    Accessing EJBObject from ejbCreate for stateless session beans
    Doubt on EJBObject