Tenho uma view chamada vw_formulario que esta mapeada da seguinte forma
package br.gov.al.gestaopublica.sed.negocio.entidades;
// Generated 09/09/2009 20:55:55 by Hibernate Tools 3.2.4.GA
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* VwFormularioId generated by hbm2java
*/
@Entity
@Table(name = "VW_FORMULARIO", schema = "dbo", catalog = "SED")
public class ServidorVOID implements java.io.Serializable {
private int idFormulario;
private String nome;
private String numCpf;
private Date dataNasc;
private String numeroAutenticador;
private String numeroProtocolo;
private int numeroOrdem;
private Integer maquina;
public ServidorVOID() {
}
public ServidorVOID(int idFormulario, int numeroOrdem) {
this.idFormulario = idFormulario;
this.numeroOrdem = numeroOrdem;
}
public ServidorVOID(int idFormulario, String nome, String numCpf,
Date dataNasc, String numeroAutenticador, String numeroProtocolo,
int numeroOrdem, Integer maquina) {
this.idFormulario = idFormulario;
this.nome = nome;
this.numCpf = numCpf;
this.dataNasc = dataNasc;
this.numeroAutenticador = numeroAutenticador;
this.numeroProtocolo = numeroProtocolo;
this.numeroOrdem = numeroOrdem;
this.maquina = maquina;
}
@Id
@Column(name = "ID_FORMULARIO", nullable = false)
public int getIdFormulario() {
return this.idFormulario;
}
public void setIdFormulario(int idFormulario) {
this.idFormulario = idFormulario;
}
@Column(name = "NOME", length = 80)
public String getNome() {
return this.nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Column(name = "NUM_CPF", length = 16)
public String getNumCpf() {
return this.numCpf;
}
public void setNumCpf(String numCpf) {
this.numCpf = numCpf;
}
@Column(name = "DATA_NASC", length = 23)
public Date getDataNasc() {
return this.dataNasc;
}
public void setDataNasc(Date dataNasc) {
this.dataNasc = dataNasc;
}
@Column(name = "NUMERO_AUTENTICADOR", length = 16)
public String getNumeroAutenticador() {
return this.numeroAutenticador;
}
public void setNumeroAutenticador(String numeroAutenticador) {
this.numeroAutenticador = numeroAutenticador;
}
@Column(name = "NUMERO_PROTOCOLO", length = 8)
public String getNumeroProtocolo() {
return this.numeroProtocolo;
}
public void setNumeroProtocolo(String numeroProtocolo) {
this.numeroProtocolo = numeroProtocolo;
}
@Column(name = "NUMERO_ORDEM", nullable = false)
public int getNumeroOrdem() {
return this.numeroOrdem;
}
public void setNumeroOrdem(int numeroOrdem) {
this.numeroOrdem = numeroOrdem;
}
@Column(name = "MAQUINA")
public Integer getMaquina() {
return this.maquina;
}
public void setMaquina(Integer maquina) {
this.maquina = maquina;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof ServidorVOID))
return false;
ServidorVOID castOther = (ServidorVOID) other;
return (this.getIdFormulario() == castOther.getIdFormulario())
&& ((this.getNome() == castOther.getNome()) || (this.getNome() != null
&& castOther.getNome() != null && this.getNome()
.equals(castOther.getNome())))
&& ((this.getNumCpf() == castOther.getNumCpf()) || (this
.getNumCpf() != null
&& castOther.getNumCpf() != null && this.getNumCpf()
.equals(castOther.getNumCpf())))
&& ((this.getDataNasc() == castOther.getDataNasc()) || (this
.getDataNasc() != null
&& castOther.getDataNasc() != null && this
.getDataNasc().equals(castOther.getDataNasc())))
&& ((this.getNumeroAutenticador() == castOther
.getNumeroAutenticador()) || (this
.getNumeroAutenticador() != null
&& castOther.getNumeroAutenticador() != null && this
.getNumeroAutenticador().equals(
castOther.getNumeroAutenticador())))
&& ((this.getNumeroProtocolo() == castOther
.getNumeroProtocolo()) || (this.getNumeroProtocolo() != null
&& castOther.getNumeroProtocolo() != null && this
.getNumeroProtocolo().equals(
castOther.getNumeroProtocolo())))
&& (this.getNumeroOrdem() == castOther.getNumeroOrdem())
&& ((this.getMaquina() == castOther.getMaquina()) || (this
.getMaquina() != null
&& castOther.getMaquina() != null && this.getMaquina()
.equals(castOther.getMaquina())));
}
public int hashCode() {
int result = 17;
result = 37 * result + this.getIdFormulario();
result = 37 * result
+ (getNome() == null ? 0 : this.getNome().hashCode());
result = 37 * result
+ (getNumCpf() == null ? 0 : this.getNumCpf().hashCode());
result = 37 * result
+ (getDataNasc() == null ? 0 : this.getDataNasc().hashCode());
result = 37
* result
+ (getNumeroAutenticador() == null ? 0 : this
.getNumeroAutenticador().hashCode());
result = 37
* result
+ (getNumeroProtocolo() == null ? 0 : this.getNumeroProtocolo()
.hashCode());
result = 37 * result + this.getNumeroOrdem();
result = 37 * result
+ (getMaquina() == null ? 0 : this.getMaquina().hashCode());
return result;
}
}
O que acontece é que quando uso o hibernate para listar os dados referentes a esta view, não da erro nenhum apenas ele executa a consulta mas não retorna nenhum dado, volta uma lista vazia. Creio que o mapeamento acima esta errado, mas não sei o que!
Quem puder me ajudar, agradeço, pois preciso disso pra ontem!
Lindberg