title: Iterate on a list with a foreign key using JSTL
body: <p>I have two tables in my database  <code>Compte</code> and  <code>Respnsable</code>. In <code>Compte</code> table I have a foreign key column "<code>responsable</code>".  What I want to do is show Responsable's name in a table of compte in a jsp page.</p>
  
  <pre><code>&lt;c:forEach items="${lescompte}" var="compt"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;${compt.idCompte}&lt;/td&gt;
                              &lt;td&gt;${compt.responsable.name}&lt;/td&gt;
                          &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>And I have this Error :</p>
  
  <blockquote>
    <p>javax.el.ELException: Error reading [name] on type
    [co.ma.entity.Responsable$$EnhancerByCGLIB$$5949c96e]</p>
  </blockquote>
  
  <p>Class Compte : </p>
  
  <pre><code>package co.ma.entity;
  // Generated 10 août 2017 21:09:03 by Hibernate Tools 5.2.3.Final
  
  import java.util.HashSet;
  import java.util.Set;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.GeneratedValue;
  import static javax.persistence.GenerationType.IDENTITY;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import javax.persistence.OneToMany;
  import javax.persistence.Table;
  
  /**
   * Compte generated by hbm2java
   */
  @Entity
  @Table(name = "compte", catalog = "topic")
  public class Compte implements java.io.Serializable {
  
      private Integer idCompte;
      private Responsable responsable;
      private Set&lt;Contact&gt; contacts = new HashSet&lt;Contact&gt;(0);
  
      public Compte() {
      }
  
      public Compte(Responsable responsable) {
          this.responsable = responsable;
      }
  
      public Compte(Responsable responsable, Set&lt;Contact&gt; contacts) {
          this.responsable = responsable;
          this.contacts = contacts;
      }
  
      @Id
      @GeneratedValue(strategy = IDENTITY)
  
      @Column(name = "Id_Compte", unique = true, nullable = false)
      public Integer getIdCompte() {
          return this.idCompte;
      }
  
      public void setIdCompte(Integer idCompte) {
          this.idCompte = idCompte;
      }
  
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "Id_Respo", nullable = false)
      public Responsable getResponsable() {
          return this.responsable;
      }
  
      public void setResponsable(Responsable responsable) {
          this.responsable = responsable;
      }
  }
  </code></pre>
  
  <p>Class Responsable : </p>
  
  <pre><code>package co.ma.entity;
  // Generated 10 août 2017 21:09:03 by Hibernate Tools 5.2.3.Final
  
  import java.util.HashSet;
  import java.util.Set;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.GeneratedValue;
  import static javax.persistence.GenerationType.IDENTITY;
  import javax.persistence.Id;
  import javax.persistence.OneToMany;
  import javax.persistence.Table;
  
  /**
   * Responsable generated by hbm2java
   */
  @Entity
  @Table(name = "responsable", catalog = "topic")
  public class Responsable implements java.io.Serializable {
  
      private Integer idRespo;
      private String name;
      private Set&lt;Compte&gt; comptes = new HashSet&lt;Compte&gt;(0);
  
      public Responsable() {
      }
  
      public Responsable(String name) {
          this.name = name;
      }
  
      public Responsable(String name, Set&lt;Compte&gt; comptes) {
          this.name = name;
          this.comptes = comptes;
      }
  
      @Id
      @GeneratedValue(strategy = IDENTITY)
  
      @Column(name = "Id_Respo", unique = true, nullable = false)
      public Integer getIdRespo() {
          return this.idRespo;
      }
  
      public void setIdRespo(Integer idRespo) {
          this.idRespo = idRespo;
      }
  
      @Column(name = "name", nullable = false, length = 25)
      public String getname() {
          return this.name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      @OneToMany(fetch = FetchType.LAZY, mappedBy = "responsable")
      public Set&lt;Compte&gt; getComptes() {
          return this.comptes;
      }
  
      public void setComptes(Set&lt;Compte&gt; comptes) {
          this.comptes = comptes;
      }
  
  }
  </code></pre>