2 Replies Latest reply on Feb 21, 2007 1:22 PM by Leo Baschy

    problem with having factory in home

    Leo Baschy Novice

      Discussed previously, but as Pete says he doesn't have that problem, here to clearly state how it happens:

      Have a Home object, e.g. CarHome extends EntityHome, named "carHome". Have a factory (as recommended by reference document) in it named "car".

      Have a page that as parameter sets carHome.id. Select from a list to go into that page, that means set the carHome.id to an existing id. First time you access the car the factory makes it by giving you that instance.

      Then for whatever reason in the same conversation come back into that page again but with a different id. Setting carHome.id switches the home object to use a new instance, but the factory made car remains the first instance!!! All wrong info displayed on page!!!

      Solution: Don't use factory in home for shortcut to instance.

      Sure, you can tell me not to come into the same page a second time in the same conversation, but I don't think that is good advice. (A colleague put a link into a sidebar that allowed it. Too many items on side of page to be able to control or enforce it.)

      I think that idea of using that factory for shorter syntax to get instance maybe shouldn't be in the reference documentation unless it is implemented differently.