0 Replies Latest reply on Nov 22, 2008 8:03 PM by Val Sw

    Need help in getting reference of entity values from Home

    Val Sw Expert

      I have few entities hierarchy is QuantExperiment > Reagent > Treatment.

      I need help in getting reference of Treatment entity data in QuantExperiment to display values in QuantExperimentEdit.xhtml using rich datatable.
      Getting reference of reagent is fine as it is directly associated with QuantExperiment.

      I tried many ways in getting Treatment details in QuantExperiment... but no luck, rich tab for treatment always say "There are no treatment associated with this reagent."

      Pls help... here are the details :
      public class QuantExperimentHome extends EntityHome<QuantExperiment> {

           @In(create = true)
           ProjectHome projectHome;
           @In(create = true)
           TreatmentHome treatmentHome;
           .... other methods generated by seam generate-ui.....
           public List<Reagent> getReagent() {
                return getInstance() == null ? null : new ArrayList<Reagent>(
           //Added to get Treatment details in QuantExperimentEdit.xhtml
           public List<Treatment> getTreatment() {
                System.out.println("**** QEHome.getTreatment(), ENTERED.....");
                return reagentHome.getInstance() == null ? null : new ArrayList<Treatment>(

      This is OK I am getting the values of reagent
      <rich:tab label="reagent">
           <div class="association" id="reagentChildren">
                <h:outputText value="There are no reagent associated with this quantExperiment."
                             rendered="#{empty quantExperimentHome.reagent}"/>
                <rich:dataTable value="#{quantExperimentHome.reagent}"
                            rendered="#{not empty quantExperimentHome.reagent}"
                          <f:facet name="header">PType</f:facet>
                          <h:outputText value="#{reagent.PType}"/>
      Trying to get the values of treatment
      <rich:tab label="treatment">
      <div class="association" id="treatmentChildren">
           <h:outputText value="There are no treatment associated with this reagent."
                        rendered="#{empty reagentHome.treatment}"/>//NEED TO HANDLE HERE
           <rich:dataTable value="#{reagentHome.treatment}" //NEED TO HANDLE HERE
                       rendered="#{not empty reagentHome.treatment}" //NEED TO HANDLE HERE
                     <f:facet name="header">note</f:facet>
                     <h:outputText value="#{treatment.note}"/>
      @Entity(name = "QuantExperiment")
      public class QuantExperiment {....

      protected List<Reagent> reagent;
      @OneToMany(cascade = {CascadeType.ALL}, mappedBy="quantExperiment")

      public List<Reagent> getReagent() {
           if (reagent == null) {
                reagent = new ArrayList<Reagent>();
      return this.reagent;
      @Entity(name = "Reagent")
      public class Reagent
          implements Equals, HashCode, ToString{
      protected List<Treatment> treatment;
      @OneToMany(cascade = {CascadeType.ALL}, mappedBy="reagent")
          public List<Treatment> getTreatment() {
              if (treatment == null) {
                  treatment = new ArrayList<Treatment>();
              return this.treatment;