8 Replies Latest reply on Jul 11, 2007 11:06 AM by Matt Drees

    EntityHome usage recommended?

    Martin Kuhn Newbie

      Hi,

      in the Seam examples, EntityHome class is rarely used.

      Could anybody share experiences of usage of EntityHome.

      Is the usage of it recommended?

      I would really appreciate a good Seam example app (with documentation) where a good separation of components is shown.

      I come from the "layering" fraction (ui,delegate,service,dao) and I'm insecure how to write my app so I'm able to reuse the components
      (still not). Of course I want to use the advantages of Seam approach.


      TIA

        • 1. Re: EntityHome usage recommended?
          Hung Tang Apprentice

           

          "maku01" wrote:
          Hi,

          Is the usage of it recommended?


          Depends if you find the barebones of EntityHome is sufficient for managing your entities. Even if it's not, you can always override it. It's basically an Entity-managed DAO. I use it and find it quite useful especially for code re-use. There are actually examples in the Seam distribution that uses entity homes. Can't remember them off the top of my head though but it's there.

          • 2. Re: EntityHome usage recommended?
            Matt Drees Master

            the ui example uses one (defined in components.xml)

            • 3. Re: EntityHome usage recommended?
              Matt Drees Master

              So, after a little searching...
              contactlist, dvdstore, quartz, seampay, wiki, and ui each use EntityHome.

              Overriding EntityHome is used in quartz, seampay, and wiki.

              Defining entity-home in components.xml is used in contactlist, dvdstore, quartz, seampay, and ui.

              seampay, interestingly enough, both overrides EntityHome *and* defines it in components.xml (<pay:payment-home>), which I hadn't realized you could do...

              • 4. Re: EntityHome usage recommended?
                Martin Kuhn Newbie

                 

                "matt.drees" wrote:
                So, after a little searching...
                contactlist, dvdstore, quartz, seampay, wiki, and ui each use EntityHome.

                Overriding EntityHome is used in quartz, seampay, and wiki.

                Defining entity-home in components.xml is used in contactlist, dvdstore, quartz, seampay, and ui.

                seampay, interestingly enough, both overrides EntityHome *and* defines it in components.xml (<pay:payment-home>), which I hadn't realized you could do...


                I can not find the usage of EntityHome in the examples you mentioned. (I use Seam 2 Beta) EntityHome programmaticaly used is in wiki, quartz and seampay examples. But my point is that there is no continuous strategy of the usage visible (at least for me).

                I consider to use EntityHome as Base class for my DAO classes. But I'm not sure wheter it would be a good decision.



                • 5. Re: EntityHome usage recommended?
                  Matt Drees Master

                  I think EntityHome is intended to be a tool that you can use however you want to use it; there doesn't appear to be one Right Way.

                  So, if I were you, I'd give a shot at building DAOs on top of EntityHome, and if it doesn't fit well, try something else. I'm experimenting a bit in my app, and I haven't quite figured out what I like best.

                  • 6. Re: EntityHome usage recommended?
                    Denis Karpov Newbie

                    What ever you do, you will need some functionality in your application that is already in EntityHome. At least, I suggest you to examine sources of it and catch the ideas and approaches . Then you can try to reuse it.

                    • 7. Re: EntityHome usage recommended?
                      Martin Kuhn Newbie

                       

                      "denis-karpov" wrote:
                      What ever you do, you will need some functionality in your application that is already in EntityHome. At least, I suggest you to examine sources of it and catch the ideas and approaches . Then you can try to reuse it.


                      I know, I already have a common class which is responsible for generic tasks like update, remove and so on. But I thought it would be better to use one base class which is written by an orm and hibernate and jpa guru like gavin king (and jsf and seam of course) :-)

                      What I not really like with the EntityHome approach ist the boundary to JSF (e.g. the automatically generated messages as result of an db operation) and the membering of the entity instance. Additionally in my base dao class I've generic list methods and I feel that the membering of the instance doesn't fit so well!

                      • 8. Re: EntityHome usage recommended?
                        Matt Drees Master

                        As a thought... you may find it useful to subclass MutableController, or PersistenceController, or Controller.