1 Reply Latest reply on Jan 7, 2009 4:12 AM by joblini

    Handling multiple queries in xxxxList.java how to achieve this in seam as per requirement

    valatharv
      Please suggest how this requirement can be achieved in seam.

      We have set of entities (Project, Experiment, Users, etc...).

      We are tracking the Creation/ Updation in of Project, Experiment using intermediate entity ExperimentHistoryRecords which stores projectId, experimentId, userId, actionType(create/ update) and date on create and update correctly.

      How can we achieve this requirement in Seam.

      a) Upon log in, users are taken to the Project list/search page and see a pre-filtered list of Projects which contain at least one experiment entered by the user (so if UserA and UserB both add experiments to Project ABC, we'd both see the project in the list)

      As per seam gen, projectList is retrieved by overriding "getEjbql()", I should join Project and ExperimentHistoryRecords entity to achieve this?? is it the right approach in Seam or any other option, please suggest..

      b) There should be a simple toggle button on the screen that says "Project User Filter". By default it's pressed and the filter is applied but by unclicking the button the user can see all projects
      -- Any suggestions if I can use toggle button in seam using richfaces, any other option ?
      -- How can I configure 2 queries in ProjectList.java or any other option to handle this ?

      ProjectList.xhtml
      -----------------
      <rich:dataTable id="projectList"
                var="project" value="#{projectList.resultList}"
         rendered="#{not empty projectList.resultList}">
      <h:column>
           #{project.projectName}
      </h:column>
      ..... other fields
      </rich:dataTable>

      ProjectList.java
      ----------------
      @Name("projectList")
      public class ProjectList extends EntityQuery {
      ...
      @Override
           public String getEjbql() {
                return "select project from Project project";
           }
      ...
      }

      ExperimentHistoryRecords
      ------------------------
      @Entity(name = "ExperimentHistoryRecords")
      @Table(name = "HISTORY_REC")
      public class ExperimentHistoryRecords implements Equals, HashCode, ToString
      {
           ....
          @ManyToOne(fetch = FetchType.LAZY, optional=false)
          public Project getProject() {
              return project;
          }

         @ManyToOne(fetch = FetchType.LAZY, optional=false)
          public Experiment getExperiment() {
              return experiment;
          }
          @ManyToOne(fetch = FetchType.LAZY, optional=false)
          public Users getUsers() {
              return users;
          }
           ....
         actionType;
         .....
         actiondate;
         .....
      }