title: Sum value of List into Bean with iReport
body: <p>Well, i have the following relationship: </p>
  
  <pre><code>  One Dentist have one or many Historys. 
  </code></pre>
  
  <p>See a peace of my Class in JPA:</p>
  
  <pre><code> public class Dentista extends AbstractBean {
  
             @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dentista", targetEntity = HistoricoCaixaDentista.class)
          private List&lt;HistoricoCaixaDentista&gt; historicosCaixa;
  </code></pre>
  
  <p>I created a JRBeanCollectionDataSource passing a list of "Dentista" with EAGER "historicosCaixa" inside each bean. </p>
  
  <p>In <em>iReport</em> I created the following field: <code>$F{historicosCaixa.valor}</code>, but when I try to execute the report I got the following error:</p>
  
  <pre><code>Caused by: java.lang.NoSuchMethodException: Unknown property 'valor' on class 'class org.hibernate.collection.PersistentBag'
  </code></pre>
  
  <p>I tried the following too: In <em>iReport</em> click in 'Edit Query', open 'JavaBean DataSource', type my class ('br.com.odontonew.bean.Dentista'), click 'Read Attrbutes'. </p>
  
  <p>After i click twice in 'historicosCaixa' property but just show 'empty' word.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>This is my HistoricoCaixaDentista class and your supperclass.</p>
  
  <pre><code>public class HistoricoCaixaDentista extends HistoricoCaixa {
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
      public static final String FIND_BY_DENTISTA = "HistoricoCaixaDentista.findByDentista";
  
      @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
      @JoinColumn(name = "id_dentista")
      private Dentista dentista;
  
  
          public Dentista getDentista() {
              return dentista;
          }
  
  
          public void setDentista(Dentista dentista) {
              this.dentista = dentista;
          }
  
  
  }
  
  public class HistoricoCaixa extends AbstractBean {
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
      @Column
      private String descricao;
  
      @Column
      private double valor;
  
      @Column(name = "data_hora")
      @Temporal(value = TemporalType.TIMESTAMP)
      private Date dataHora;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "id_usuario")
      private Usuario usuario;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "id_forma_pagamento")
      private FormaPagamento formaPagamento;
  
      @OneToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "id_historico_pagamento")
      private HistoricoPagamento historicoPagamento;
  
      public String getDescricao() {
      return descricao;
      }
  
      public void setDescricao(String descricao) {
      this.descricao = descricao;
      }
  
      public double getValor() {
      return valor;
      }
  
      public void setValor(double valor) {
      this.valor = valor;
      }
  
      public Date getDataHora() {
      return dataHora;
      }
  
      public void setDataHora(Date dataHora) {
      this.dataHora = dataHora;
      }
  
      public Usuario getUsuario() {
      return usuario;
      }
  
      public void setUsuario(Usuario usuario) {
      this.usuario = usuario;
      }
  
      public FormaPagamento getFormaPagamento() {
      return formaPagamento;
      }
  
      public void setFormaPagamento(FormaPagamento formaPagamento) {
      this.formaPagamento = formaPagamento;
      }
  
      public HistoricoPagamento getHistoricoPagamento() {
      return historicoPagamento;
      }
  
      public void setHistoricoPagamento(HistoricoPagamento historicoPagamento) {
      this.historicoPagamento = historicoPagamento;
      }
  
      public String getColorStyle() {
      if (this.valor &gt; 0) {
          return "background-color:blue";
      } else {
          return "background-color:red";
      }
      }
  }
  </code></pre>