0 Replies Latest reply on Nov 30, 2009 4:14 PM by poschd

    Nested <rich:dataList>s result in javax.el.PropertyNotFoundException

    poschd

      Hi everyone,


      I am new to JBoss Seam and I have got a problem when using nested <rich:dataList>s. Basically, what I want to do is automatically generate markers and corresponding descriptions for Google Maps (using <rich:gmap>).
      The database database table that contains all necessary information (net_elements) has a foreign key to a location table, so here are my entity beans:


      // NetElements.java:
      //...
      @Entity
      @Table(name = "net_elements")
      public class NetElements implements java.io.Serializable {
      //...
           @Id
           @Column(name = "netelementname", unique = true, nullable = false)
           @NotNull
           public String getNetelementname() {
                return this.netelementname;
           }
      
           @ManyToOne(fetch = FetchType.LAZY)
           @JoinColumn(name = "location")
           public Location getLocation() {
                return this.location;
           }
      //...
      }
      



      // Location.java:
      //...
      @Entity
      @Table(name = "location")
      public class Location implements java.io.Serializable {
      //...
           @OneToMany(fetch = FetchType.LAZY, mappedBy = "location")
           public Set<NetElements> getNetElements() {
                return this.netElements;
           }
      //...
      }
      



      I came across this blog entry from John Haselden and took over the basic idea to generate the markers. The code to control the gmap is written in JavaScript and was tested, so it works. What I do now is iterate over all locations using a simple <rich:dataList> and fetch all netelements for each location using a nested <rich:dataList>.


      <!-- code snippet: data list for GMap marker generation-->
      <s:div style="visibility:hidden">
           <rich:dataList id="locationList" var="location"
                value="#{locationList.resultList}">
                <script type="text/javascript">
                     clearMarkerDesc();
                     appendToMarkerDesc('<h:outputText value="#{location.id}: #{location.address} (#{location.netElements.size})"/><br/>');                                   
                </script>
                <rich:dataList var="netelement" value="#{location.netElements}"
                     id="netelementsList" rendered="#{not empty location.netElements}">
                          <script type="text/javascript">
                               appendToMarkerDesc('<h:outputLink value="/NetElementsIllustration.xhtml"><f:param name="netelement" value="#{netelement.netelementname}" /><h:outputText value="#{netelement.netelementname}"/></h:outputLink><br/>');
                          </script>
                </rich:dataList>
                <script type="text/javascript">
                     addNetelement('<h:outputText value="#{location.id}" />', '<h:outputText value="#{location.address}" />', getMarkerDesc());
                </script>
           </rich:dataList>
      </s:div>



      Well, I know the code looks kind of clumsy, but I haven't yet found a better way to call my JavaScript functions... Anyway, the result of this is a


      javax.el.PropertyNotFoundException: /map.xhtml @142,147 value="#{netelement.netelementname}": Property 'netelementname' not found on type org.hibernate.collection.PersistentSet



      I have lost hours to find a solution for this issue, but I could not figure out what causes this exception. Are there any suggestions of what has gone wrong?


      Best regards,
      Daniel