3 Replies Latest reply on Mar 27, 2006 8:44 AM by eekboom

    encapsulate entity beans?

    eekboom

      Now that entity beans are simply POJOs: Is it still considered best practice to pass value objects to the client?
      Most of the EJB 3 examples I have seen so far use entity beans directly in the JSF/client layer.

      I tried to encapsulate getters/setter of entity beans in an interface and use only that in the JSF layer, but of course that does not work because entity beans must also be created on the client side.

      What do others do?

        • 1. Re: encapsulate entity beans?
          squishy

          that would interest me a lot too, because i'm going to port many ejb 2.0 entities that use value objects to ejb 3.0 and i'm not sure if it's good to keep the value objects either.

          • 2. Re: encapsulate entity beans?
            epbernard

            DTO are no longer useful except for specific cases where for eg you don't want only a small subset fo the object information (like a search screen showing only a summary of the object proeprties).

            If you use JSF and EJB3, I strongly encourage you to check JBoss Seam, you'll have more time to spend with your familly :-)

            • 3. Re: encapsulate entity beans?
              eekboom

               

              "epbernard" wrote:
              DTO are no longer useful except for specific cases where for eg you don't want only a small subset fo the object information (like a search screen showing only a summary of the object proeprties).

              If you use JSF and EJB3, I strongly encourage you to check JBoss Seam, you'll have more time to spend with your familly :-)


              Thanks a lot. The part about seam currently feels a little ironic: We already started integrating seams on Thursday. Today should have been a day off for me to spent with my family. Instead I spent it on trying to get seam up and running. The latest quirk was that I did not have an empty (!) seam.properties included in all my ejb modules.
              Anyway - it's running now and I can see that it will be a time saver for the rest of my project.

              The good thing is that you can indeed have your entities split into interfaces for the JSF side and implementation (at least while running both on the same server):
              There are no annotations at all in the interfaces, they are contained in a plain old java se jar.
              The implementations are (heavily) annotated and seam will instantiate them behind the scenes if they are used in jsf's el.