Boas colegas, estou a deparar me com um problema durante o processo de obtenção de relatorios através do JasperReports
. Ao tentar gerar o relatorio, é lançado o seguinte erro : Caused by: java.lang.NoSuchMethodException:
Unknown property 'ute_id' on class 'class mz.com.centropontoencontro.domain.Utente'
Já tentei pesquisar no google mais ainda não tive sucesso. Abaixo irei deixar o codigo.
Log do erro:
here was an unexpected error (type=Internal Server Error, status=500).
Error retrieving field value from bean: ute_id.
net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: ute_id.....
Caused by: java.lang.NoSuchMethodException: Unknown property 'ute_id' on class 'class mz.com.centropontoencontro.domain.Utente'
não deu para por tudo…
Arquivo Jrxml:
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="utentes_report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c08e332f-a6e9-4a94-b8db-8e47a666e1dc">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="bdcentro_adapter"/>
<queryString language="SQL">
<![CDATA[select * from ute_utente as u inner join ins_instituicaoensino as i on u.ute_instituicaoid=i.ins_id;]]>
</queryString>
<field name="ute_id" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.label" value="ute_id"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_datanascimento" class="java.sql.Date">
<property name="com.jaspersoft.studio.field.label" value="ute_datanascimento"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_nome" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="ute_nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_genero" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="ute_genero"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_naturalidade" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="ute_naturalidade"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_estado" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="ute_estado"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_numeroemps" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.label" value="ute_numeroemps"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ute_data_registo" class="java.sql.Timestamp">
<property name="com.jaspersoft.studio.field.label" value="ute_data_registo"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ute_utente"/>
</field>
<field name="ins_nome" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="ins_nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="ins_instituicaoensino"/>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="56" splitType="Stretch">
<staticText>
<reportElement x="-20" y="0" width="595" height="54" uuid="24a0c541-3122-4c02-a621-0a906f4bf4e1"/>
<box>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Ink Free" size="42"/>
</textElement>
<text><![CDATA[Centro Ponto de Encontro]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="47" splitType="Stretch">
<staticText>
<reportElement x="-20" y="-1" width="595" height="48" uuid="5809f1ff-0811-4a81-9631-79321113bd7b"/>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="16" isUnderline="false"/>
</textElement>
<text><![CDATA[Relatório de utentes do Centro Ponto de Encontro]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="32" splitType="Stretch">
<staticText>
<reportElement x="30" y="0" width="100" height="30" uuid="7f4acc0b-a144-4f33-a4ef-ddb815a2963a">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="80fac72d-bc02-4ee4-ac3c-1315a10917ec"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Nome completo]]></text>
</staticText>
<staticText>
<reportElement x="130" y="0" width="50" height="30" uuid="87511b42-cde0-4b7f-999c-4dc2aff055d0">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="f3681884-82bc-4ae6-b17f-ac2c9f55400c"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Género]]></text>
</staticText>
<staticText>
<reportElement x="180" y="0" width="100" height="30" uuid="c57fe7ef-137d-4f36-a5a7-06ec8e934735">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fb474402-fb7a-4254-a631-31611b8133f1"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Naturalidade]]></text>
</staticText>
<staticText>
<reportElement x="280" y="0" width="60" height="30" uuid="9d325c25-02c3-4bf9-a7a1-84ade4895a60">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="03b7b055-3ddd-4c6a-8cdb-28c08f43a6d5"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Nº emprestimos]]></text>
</staticText>
<staticText>
<reportElement x="340" y="0" width="90" height="30" uuid="d786558a-f9c4-4731-b38e-edece1a039ad">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="330877cc-cbfb-4a2b-a6fc-a1d328158f9b"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Instituição ensino]]></text>
</staticText>
<staticText>
<reportElement x="430" y="0" width="70" height="30" uuid="208c87dc-f04d-49ef-ae8b-7361afdd449a">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d7e4d669-896b-437b-84ac-45f8051fa504"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Estado]]></text>
</staticText>
<staticText>
<reportElement x="500" y="0" width="75" height="30" uuid="0f45f779-bf9c-4365-b3b1-998bb06404c6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="ab6f7f4e-181b-4394-b761-7ea386a26765"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Data registo]]></text>
</staticText>
<staticText>
<reportElement x="-20" y="0" width="50" height="30" uuid="fdabf65e-40c1-4e5d-99ba-28a61de09a1e">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="b3fac750-41d3-43cc-81af-7eda5cff3fb2"/>
</reportElement>
<box>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[#]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="45" splitType="Stretch">
<textField>
<reportElement x="30" y="0" width="100" height="30" uuid="8d7b60b6-8984-424f-bdc8-dcfd39282023">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="80fac72d-bc02-4ee4-ac3c-1315a10917ec"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_nome}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="130" y="0" width="50" height="30" uuid="c184f857-6b23-4f4b-86a9-c7d40df10a6a">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="f3681884-82bc-4ae6-b17f-ac2c9f55400c"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_genero}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="100" height="30" uuid="5a4a9ba1-9e90-458e-a636-2c673c47e6c3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fb474402-fb7a-4254-a631-31611b8133f1"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_naturalidade}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="0" width="60" height="30" uuid="573e6aca-5a2c-4374-a531-8278b301c573">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="03b7b055-3ddd-4c6a-8cdb-28c08f43a6d5"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_numeroemps}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="430" y="0" width="70" height="30" uuid="75a880eb-7a1e-455c-95a0-1dcd0242166b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d7e4d669-896b-437b-84ac-45f8051fa504"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_estado}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="500" y="0" width="75" height="30" uuid="2170db10-8bb7-4c53-b2c9-81f4b21bd1d2">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="ab6f7f4e-181b-4394-b761-7ea386a26765"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ute_data_registo}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="0" width="90" height="30" uuid="88b31817-73e5-4b9f-be0a-656560323c96">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="73f3cbc3-6b94-4288-ac57-3058c3526d3c"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ins_nome}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="-20" y="-2" width="50" height="30" uuid="dd8eb99b-dcb1-4f42-9eb4-8c8c1f0f1a72">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="b3fac750-41d3-43cc-81af-7eda5cff3fb2"/>
</reportElement>
<textFieldExpression><![CDATA[$F{ute_id}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="94" splitType="Stretch">
<textField>
<reportElement x="180" y="60" width="100" height="30" uuid="2c5fe446-5f1c-4782-8598-bbbb02dbb049"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Página " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="60" width="100" height="30" uuid="7ec7e5eb-ef5c-4716-ba6c-0894f13f6002"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[" de " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
classe domain
@Entity
@Table (name = "ute_utente")
public class Utente{
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ute_id")
private Long id;
// @NotBlank(message = "Campo inválido. Não deve conter espaços em branco")
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @Size(message = "Apenas são permitidos {max} caracteres", max = 100)
@Column(name = "ute_nome")
private String nome;
// @PastOrPresent(message = "Data inválida")
// @NotNull(message = "Selecione uma data válida")
@Column(name = "ute_datanascimento")
@DateTimeFormat(iso = ISO.DATE)
private LocalDate dataNascimento;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
@Column(name = "ute_genero")
private String genero;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @NotBlank(message = "Campo inválido. Não deve conter espaços em branco")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 50)
@Column(name = "ute_naturalidade")
private String naturalidade;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @NotBlank(message = "Campo inválido. Não deve conter espaços em branco")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 13)
@Column(name = "ute_bi")
private String numeroBi;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 100)
@Column(name = "ute_nomemae")
private String nomeMae;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 100)
@Column(name = "ute_nomepai")
private String nomePai;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 50)
@Column(name="ute_localtrabalho")
private String localTrabalho;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
// @Size(message = "Apenas são permitidos {max} caracteres.", max = 9)
@Column(name = "ute_contacto")
private String contacto;
// @NotNull(message = "Campo inválido. Não deve ficar vazio")
@Column(name="ute_estado")
private String estado;
@Column(name = "ute_numeroemps")
private Long numeroEmprestimos;
@Column(name = "ute_data_registo", nullable = false)
private LocalDateTime dataRegisto;
// @Valid
@ManyToOne
@JoinColumn(name = "ute_instituicaoid")
private InstituicaoEnsino instituicaoEnsino;
// @Valid
@JoinColumn(name = "ute_enderecoid")
@OneToOne(cascade = CascadeType.ALL)
private Endereco endereco;
@OneToMany(mappedBy = "utenteEmprestimo")
private List<Emprestimo> emprestimos;
@OneToMany(mappedBy = "utenteDevolucoes")
private List<Devolucao> devolucoes;
@OneToMany(mappedBy = "utente")
private List<EstudanteAprovado> listaAprovados;
@OneToMany(mappedBy = "utente")
private List<EstudanteReprovado> listaReprovacoes;
@OneToMany(mappedBy = "utente")
private List<EstudanteDesistencia> listaDesistencia;
public List<EstudanteDesistencia> getListaDesistencia() {
return listaDesistencia;
}
public void setListaDesistencia(List<EstudanteDesistencia> listaDesistencia) {
this.listaDesistencia = listaDesistencia;
}
public List<EstudanteReprovado> getListaReprovacoes() {
return listaReprovacoes;
}
public void setListaReprovacoes(List<EstudanteReprovado> listaReprovacoes) {
this.listaReprovacoes = listaReprovacoes;
}
public List<EstudanteAprovado> getListaAprovados() {
return listaAprovados;
}
public void setListaAprovados(List<EstudanteAprovado> listaAprovados) {
this.listaAprovados = listaAprovados;
}
public List<Devolucao> getDevolucoes() {
return devolucoes;
}
public void setDevolucoes(List<Devolucao> devolucoes) {
this.devolucoes = devolucoes;
}
public InstituicaoEnsino getInstituicaoEnsino() {
return instituicaoEnsino;
}
public void setInstituicaoEnsino(InstituicaoEnsino instituicaoEnsino) {
this.instituicaoEnsino = instituicaoEnsino;
}
public List<Emprestimo> getEmprestimos() {
return emprestimos;
}
public void setEmprestimos(List<Emprestimo> emprestimos) {
this.emprestimos = emprestimos;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public LocalDate getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(LocalDate dataNascimento) {
this.dataNascimento = dataNascimento;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public String getNaturalidade() {
return naturalidade;
}
public void setNaturalidade(String naturalidade) {
this.naturalidade = naturalidade;
}
public String getNumeroBi() {
return numeroBi;
}
public void setNumeroBi(String numeroBi) {
this.numeroBi = numeroBi;
}
public String getNomeMae() {
return nomeMae;
}
public void setNomeMae(String nomeMae) {
this.nomeMae = nomeMae;
}
public String getNomePai() {
return nomePai;
}
public void setNomePai(String nomePai) {
this.nomePai = nomePai;
}
public String getLocalTrabalho() {
return localTrabalho;
}
public void setLocalTrabalho(String localTrabalho) {
this.localTrabalho = localTrabalho;
}
public String getContacto() {
return contacto;
}
public void setContacto(String contacto) {
this.contacto = contacto;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public Long getNumeroEmprestimos() {
return numeroEmprestimos;
}
public void setNumeroEmprestimos(Long numeroEmprestimos) {
this.numeroEmprestimos = numeroEmprestimos;
}
public LocalDateTime getDataRegisto() {
return dataRegisto;
}
public void setDataRegisto(LocalDateTime dataRegisto) {
this.dataRegisto = dataRegisto;
}
public InstituicaoEnsino getInsEnsino() {
return instituicaoEnsino;
}
public void setInsEnsino(InstituicaoEnsino insEnsino) {
this.instituicaoEnsino = insEnsino;
}
public Endereco getEndereco() {
return endereco;
}
public void setEndereco(Endereco endereco) {
this.endereco = endereco;
}
}