3 Replies Latest reply on Mar 23, 2007 4:06 AM by pmuir

    Please, help to find optimal strategy for multiple iteration

    anarinsky

      For the sake of simplicity my database contains 2 tables ? containers and fruits. I need to show a report that contains a list of fruits for every container

      So, on my report page I have to iterate through the list of containers and for every container show the list of fruits

      I generated the entities using seam-gen and received the following objects:
      Container
      ContainerList
      ContainerHome

      Fruit
      FruitList
      FruitHome


      In the Container object I have the method that retrieves the set of fruits. However, due to the specifics of JSF I cannot iterate through the set on the page ? I can iterate only through the list. Also, the ContainerHome object has a method that retrieves the list of fruits for a particular container.

      Please, let me know what it the best strategy?

      I think that I have several options. First, I can add @Transient method in the Container object that retrieves the list of fruits. What is better ? to use the existent Set method and transfer Set to List or to write another query?

      Second, I can somehow for every Container use the List method specified in the ContainerHome object. However, I do not know how to get the reference to the ContainerHome object for a particular Id on a JSF.

      Should I create a new Session Bean for this task or I can use only Entity beans originally generated by seam-gen?

      Thank you very much for a feedback