3 Replies Latest reply on Jan 24, 2003 2:28 PM by mbabauer

    Newbie question...

    mbabauer

      I am trying to wrap my brain around how a lot of this works, and of yet I haven't really found any decent books that really explain how all this J2EE works. Most focus on life-cycles and what-not, and say little or nothing about how to actually USE this, and best/worse practices.

      Anyway, I have a Entity bean called CustomerBean. CustomerBean has both a local and remote interface. CustomerBean has a few methods, one of which is a method that return a java.util.Vector containing a list of "accounts", which are represented by an Entity AccountBean.

      Now, CustomerBean will most likely be used remotely, although this hasn't been worked out 100%. My question is this. If I put the remote interfaces on CustomerBean, which returns a Vector of AccountBeans, do I need to have a remote interface on AccountBean as well? Also, since AccountBean does not directly implement the AccountBeanLocal interface, how does the poly-morphism work? Does it serialize the AccountBeanLocal, or does it send the AccountBeans themselves? If its the AccountBeanLocal, will the method calls work?

      Any help would be appreciated. Also, if anyone knows of any books that do not delve deep into the recesses of EJB Container UML diagrams and focuses more on the low-down of writting a good EJB implementation using JBoss, I would appreciate that too.

        • 1. Re: Newbie question...

          You cannot use a local interface remotely.

          JBoss implements the remote/local interface
          (the EJB Container). This container handles some
          of the methods and passes other to your bean.

          The bean lives inside the container, the container
          implementation creates a remote object for use
          by the client.

          It is usually a bad idea to directly expose entity
          beans to clients.
          Each getSomething() and setSomething() results
          in a network request and probably a new transaction.
          This is very slow.

          These books are probably what you are looking for?
          http://www.theserverside.com/books/EJBDesignPatterns/index.jsp
          http://www.theserverside.com/resources/bitterEJBreview.jsp

          Regards,
          Adrian

          • 2. Re: Newbie question...
            hammerchampy

            Hello. I had the same problem when I began to study J2EE.

            For me, in this case, if you're managing an account, usign an EntityBean like AccountBean, and you wish to obtain a Collection, or vector of accounts, it's better to do it, in the AccountBean, and not in the CustomerBean. The way to do it is receiving in your AccountBean a parameter, like the Id, or number of the customer.

            Good luck.

            • 3. Re: Newbie question...
              mbabauer

              Thanks guys/gals...you gave me a great place to start.