1 Reply Latest reply on Jan 16, 2007 12:17 AM by smokingapipe

    When to use @Factory

      In general, what's the difference between using @Factory and not? When should @Factory be used? What's the difference between the following two options (e.g. for populating a datamodel, or even for doing something else).

      @DataModel
      private List<Stuff> stuff;
      
      @Factory
      public void getStuff() {
       stuff = findListOfStuff();
      }


      @DataModel
      public List<Stuff> getStuff() {
       return findListOfStuff();
      }


        • 1. Re: When to use @Factory
          smokingapipe

          I think your option #1 is good when a conversation is starting. What if it needs to display this list several times i the conversation? You don't want to call findListOfStuff() every time it is displayed, because that might involve DB queries, etc.

          Option #2 is ok if it's ok to regenerate the list every time.