2 Replies Latest reply on Dec 14, 2004 8:45 AM by bill.burke

    Using Interfaces for Entity Beans

    mduffy_lists

      The EJB 3.0 Spec, in section "2.2 Business Interfaces", states "Business interfaces in the sense of this chapter are not defined for entity beans[1]." The spec goes on to say, "The developer may choose to layer business interfaces on entity beans. The techniques for doing this are not defined by this specification."

      In another reference, "6.1 Requirements on the Entity Bean Class", the spec states, "If the entity bean is to be passed by value as a detached object (e.g., through a remote interface), it must implement the Serializable interface."

      I noticed in the JBoss EJB 3.0 tutorial that all the entity beans do in fact implement a bsuiness interface and the interfaces are @Remote instead of @Local.

      Two questions:

      What are the advantages of implementing an interface for an enity bean?

      What are the advantages of implementing of implementing a @Remote interface instead of a @Local interface?

      Thx.

      Mike

        • 1. Re: Using Interfaces for Entity Beans
          kabirkhan

          Look again :-)

          In the examples it is the session beans that implement business interfaces, some of which are annotated @Remote.

          A session bean with a business interface marked as @Remote instead of @Local can be accessed from outside the JVM.

          • 2. Re: Using Interfaces for Entity Beans
            bill.burke

            The container will not do anything special for an entity bean implementing an interface tagged as @Remote. The entity beans in the tutorial are Serializable so that they can be detached and sent across the network in the examples.

            Entity beans cannot be accessed remotely.

            Bill