title: read persistente bag property in xhtml (jsf)
body: <p>Morning Stack members,</p>
  
  <p>Would you please help me with this issue ?</p>
  
  <p>Im trying to read a persistent set property from an object but it returns only one row and  I have in database table two inserted rows for such id</p>
  
  <ul>
  <li>How can I load in dataTable all the rows ?</li>
  <li>How can I read all the fields loaded in the LinkHashSet table as id,name,description,etc...</li>
  </ul>
  
  <p><strong>Bean :</strong></p>
  
  <pre><code>@Inject
  private Pessoa pessoa;
  </code></pre>
  
  <p><strong>Entity Pessoa :</strong></p>
  
  <pre><code>@Entity
  @Table(name = "pessoa",uniqueConstraints = {@UniqueConstraint(columnNames = { "idt_pessoa" }) })
  @Inheritance(strategy = InheritanceType.JOINED)
  @OneToMany
  @JoinColumn(name = "idt_pessoa")
  private Set&lt;ContatoPessoa&gt; contatoPessoas = new LinkedHashSet&lt;ContatoPessoa&gt;();
  
  public Set&lt;ContatoPessoa&gt; getContatoPessoas() {
      return contatoPessoas;
  }
  
  public void setContatoPessoas(Set&lt;ContatoPessoa&gt; contatoPessoas) {
      this.contatoPessoas = contatoPessoas;
  }
  </code></pre>
  
  <p><strong>ContatoPessoa entity :</strong></p>
  
  <pre><code>@Entity
  @Table(name="contato_pessoa")
  public class ContatoPessoa implements Entidade{
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "idt_contatoPessoa")
  private Long id;
  
  @Column(length=100)
  private String des_areaContatoPessoa;
  
  @Column(length=100)
  private String des_emailContatoPessoa;
  </code></pre>
  
  <p><strong>In xhtml :</strong></p>
  
  <pre><code>&lt;p:dataTable id="dTContato" var="contatoPessoas"
  value="#{pessoaMB.pessoa.contatoPessoas}"
  rowKey="#{pessoa.contatoPessoas.id}"&gt;
  &lt;p:column headerText="#{bundle.pessoa_lblid}"&gt;
  &lt;p:outputLabel value="#{contatoPessoas.key}"/&gt;
  &lt;/p:column&gt;
  </code></pre>
  
  <p>Ive tried with different combinations in xhtml <code>p:outputLabel</code> but with no success at all</p>
  
  <p>I watched the persistent set from an object <code>pessoa</code> and it has values. The bag is an <code>ArrayList</code></p>
  
  <p>I have no reputation to post images. sorry</p>