3 Replies Latest reply on Aug 27, 2007 10:30 AM by Samuel Mendenhall

    how to use DataModelSelectionIndex correctly ?(newbie questi

    Andy Shiue Newbie


      Trying to use the DataModelSelectionIndex to pick up particular row of data and use it to do another query from other Action.java. I am not sure if I have done it right or not. I just can't get the data from the database.

      this is what I have done. Have been stuck on it for a while. Appreciate any help.

      private List<Customer > customers;
      private int customerIndex;
      private Customer customer;
      public void findCustomers()
       customers = em.createQuery("select c from customer c").getResultList();
      public String selectcustomer()
      public void setcustomer()
       customer= customers.get(customerIndex);

      And I inject customer on the other Action.java and use it to query for related data. but it doesn't work. Am I doing it wrong?

      Here's the code for second Action.java

      private Customer customer;
      private List<Result> results;
      public void getResult()
      results = em.createQuery("select r from Result r where r.subscription_id = :SID")
      .setParameter("SID", patient.getId())

      build and deploy successfully but just not returning anything from getResult, a blank page. I have no idea why.