Error generating report with more than one relationship - Demoiselle Report

1
Hello everyone, I am trying to generate a report with demoiselle report, and I am not able to generate a report when I have more than one relationship, when I generate the report from a single table it works perfectly, it just does not work when it is related in more than one table, which would look like this:

My report query:

SELECT
     DesignacaoRotineira."anoReferencia" AS anoReferencia,
     DesignacaoRotineira."tx_assunto" AS assunto,
     DesignacaoRotineira."tx_codigoDesignacao" AS codigoDesignacao,
     DesignacaoRotineira."dataEmissao" AS dataEmissao,
     DesignacaoRotineira."mesReferencia" AS mesReferencia,
     Lotacao."tx_codigoLotacao" AS codigoLotacao,
     Lotacao."tx_NomeLotacao" AS nomeLotacao
FROM
     "dbo"."Lotacao" Lotacao INNER JOIN "dbo"."DesignacaoRotineira" DesignacaoRotineira ON Lotacao."id_Lotacao" = DesignacaoRotineira."fk_lotacao_id"
WHERE
     DesignacaoRotineira."id_designacao" = $P{id}

How do I solve this problem? I took care to leave the aliases according to the attributes of the classes.

The exception that occurs is as follows:

net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : codigoLotacao

java.lang.NoSuchMethodException: Unknown property 'codigoLotacao' on class 'class br.gov.ro.portovelho.semfaz.sisfiscal.domain.DesignacaoRotineira'

Method that generates report:

@Inject
    @Path("reports/designcaoRotineira.jasper")
    private Report relatorioPorDesignacao;

    public StreamedContent getArquivoRelatorioPorDesignacao(Long id){

        FacesContext context = FacesContext.getCurrentInstance();
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("id",id);
        Collection<DesignacaoRotineira> dadosRelatorio = getResultList();

        try {
            byte[] buffer = relatorioPorDesignacao.export(dadosRelatorio,param,Type.PDF);
            ByteArrayInputStream bis = new ByteArrayInputStream(buffer);
            return new DefaultStreamedContent(bis, "application/pdf","designacaoRotineira.pdf");
        } catch (RuntimeException e) {
            e.printStackTrace();
            context.addMessage( null,new FacesMessage(e.getMessage()));
        }
        return null;
    }

Parent Class Designation

@Entity
public class DesignacaoRotineira extends Designacao  {

    private static final long serialVersionUID = 1L;

    @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.PERSIST)
    private GrupoTrabalho grupoTrabalho;

    public DesignacaoRotineira() {

    }

    public DesignacaoRotineira(GrupoTrabalho grupoTrabalho) {
        super();
        this.grupoTrabalho = grupoTrabalho;
    }


    public GrupoTrabalho getGrupoTrabalho() {
        return grupoTrabalho;
    }

    public void setGrupoTrabalho(GrupoTrabalho grupoTrabalho) {
        this.grupoTrabalho = grupoTrabalho;
    }
}

Daughter Class Designation Rotineira:

//import ...

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Designacao implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE)
    @Column(name = "id_designacao")
    private Long id;

    @Column(name = "tx_codigoDesignacao", unique = true, nullable = false)



    private String codigoDesignacao;

    @Column(name = "tx_assunto")
    private String assunto;

    @Temporal(TemporalType.TIMESTAMP)
    private Date dataEmissao = new Date();

    @Enumerated(EnumType.STRING)
    private EnumSituacaoDesignacao enumSituacaoDesignacao = EnumSituacaoDesignacao.ABERTA;


    private int mesReferencia = new GregorianCalendar().get(Calendar.MONTH) + 1;

    private Integer anoReferencia = new GregorianCalendar().get(Calendar.YEAR);

    @OneToOne
    @JoinColumn(name = "fk_lotacao_id")
    private Lotacao lotacao;

    @OneToMany(mappedBy = "designacao",cascade = {CascadeType.REMOVE})
    private List<LancamentoServicoDesignacao> lancamentosServicoDesignacao;

    public Designacao() {

    }



    public Designacao(String codigoDesignacao, String assunto, Date dataEmissao) {
        super();
        this.codigoDesignacao = codigoDesignacao;
        this.assunto = assunto;
        this.dataEmissao = dataEmissao;

    }

    public Designacao(String codigoDesignacao, String assunto,
            Date dataEmissao, Lotacao lotacao,
            EnumSituacaoDesignacao enumSituacaoDesignacao, int mesReferencia,
            int anoReferencia,List<LancamentoServicoDesignacao> lancamentosServicoDesignacao) {
        super();
        this.codigoDesignacao = codigoDesignacao;
        this.assunto = assunto;
        this.dataEmissao = dataEmissao;
        this.enumSituacaoDesignacao = enumSituacaoDesignacao;
        this.lotacao = lotacao;
        this.mesReferencia = mesReferencia;
        this.anoReferencia = anoReferencia;
        this.lancamentosServicoDesignacao = lancamentosServicoDesignacao;
    }

    public String getCodigoDesignacao() {
        return codigoDesignacao;
    }

    public void setCodigoDesignacao(String codigoDesignacao) {

        this.codigoDesignacao = codigoDesignacao.length() > codigoDesignacao
                .length() ? codigoDesignacao : codigoDesignacao + "."
                + lotacao.getSecretaria().getCodigoSecretaria() + "" + "."
                + lotacao.getCodigoLotacao() + "" + "." + this.mesReferencia
                + "" + "/" + anoReferencia;
    }


    //getandsetters...
}

Lotation Class:

package br.gov.ro.portovelho.semfaz.sisfiscal.domain;

//import...

@Entity
public class Lotacao implements Serializable {


    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id_Lotacao")
    private Long id;

    @Column(name = "tx_NomeLotacao")
    private String nomeLotacao;

    @Column(name = "tx_codigoLotacao")
    private String codigoLotacao;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_secretaria_fk",nullable=false)
    private Secretaria secretaria;

    @OneToOne
    @JoinColumn(name = "id_tipoFiscalizacao_fk")
    private TipoFiscalizacao tipoFiscalizacao;

    public Lotacao() {

    }

    public Lotacao(Secretaria secretaria) {
        super();
        this.secretaria = secretaria;
    }


    public Lotacao(String nomeLotacao, Secretaria secretaria, TipoFiscalizacao tipoFiscalizacao) {
        super();
        this.tipoFiscalizacao = tipoFiscalizacao;
        this.nomeLotacao = nomeLotacao;
        this.secretaria = secretaria;
    }




    // getter and setters omitidos e hash and equals

}
    
asked by anonymous 10.06.2015 / 17:39

0 answers