Boa tarde caros amigos. estou com o seguinte problema. Estou tentando gravar os dados digitados pelo usuario, e ocorre erro do tipo “retornado null”. Não sei que erro é esse. Aqui embaixo, algumas explicações.
meu Bean
@Entity(name="tbsisc_viagem")
@Table(name="tbsisc_viagem")
public class Viagem {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="pktbsisc_viagem")
private Integer id;
@Column(name="ds_cidade")
private String cidade;
@Column(name="ds_objetivo")
private String objetivo;
@Column(name="dt_periodoinicial")
private Date periodoInicial;
@Column(name="dt_periodofinal")
private Date periodoFinal;
@Column(name="ds_pessoa")
private String nomePessoa;
@Column(name="in_passagem")
private boolean passagem;
@Column(name="in_ajudacusto")
private boolean ajudaDeCusto;
@Column(name="in_diaria")
private boolean diaria;
@Column(name="in_coletiva")
private boolean coletiva;
@Column(name="vl_ajudacusto")
private int valorDaAjudaDeCusto;
@Column(name="vl_diaria")
private Double valorDaDiaria;
@Column(name="vl_passagens")
private Double valorDaPassagem;
public Viagem() {
}
/**
* @param id
* @param objetivo
* @param periodoInicial
* @param periodoFinal
* @param nomePessoa
* @param passagem
* @param ajudaDeCusto
* @param diaria
* @param coletiva
* @param valorDaAjudaDeCusto
* @param valorDaDiaria
* @param valorDaPassagem
*/
public Viagem(Integer id, String objetivo, Date periodoInicial,
Date periodoFinal, String nomePessoa, boolean passagem,
boolean ajudaDeCusto, boolean diaria, boolean coletiva,
int valorDaAjudaDeCusto, Double valorDaDiaria,
Double valorDaPassagem) {
super();
this.id = id;
this.objetivo = objetivo;
this.periodoInicial = periodoInicial;
this.periodoFinal = periodoFinal;
this.nomePessoa = nomePessoa;
this.passagem = passagem;
this.ajudaDeCusto = ajudaDeCusto;
this.diaria = diaria;
this.coletiva = coletiva;
this.valorDaAjudaDeCusto = valorDaAjudaDeCusto;
this.valorDaDiaria = valorDaDiaria;
this.valorDaPassagem = valorDaPassagem;
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the objetivo
*/
public String getObjetivo() {
return objetivo;
}
/**
* @param objetivo the objetivo to set
*/
public void setObjetivo(String objetivo) {
this.objetivo = objetivo;
}
/**
* @return the periodoInicial
*/
public Date getPeriodoInicial() {
return periodoInicial;
}
/**
* @param periodoInicial the periodoInicial to set
*/
public void setPeriodoInicial(Date periodoInicial) {
this.periodoInicial = periodoInicial;
}
/**
* @return the periodoFinal
*/
public Date getPeriodoFinal() {
return periodoFinal;
}
/**
* @param periodoFinal the periodoFinal to set
*/
public void setPeriodoFinal(Date periodoFinal) {
this.periodoFinal = periodoFinal;
}
/**
* @return the nomePessoa
*/
public String getNomePessoa() {
return nomePessoa;
}
/**
* @param nomePessoa the nomePessoa to set
*/
public void setNomePessoa(String nomePessoa) {
this.nomePessoa = nomePessoa;
}
/**
* @return the passagem
*/
public boolean isPassagem() {
return passagem;
}
/**
* @param passagem the passagem to set
*/
public void setPassagem(boolean passagem) {
this.passagem = passagem;
}
/**
* @return the ajudaDeCusto
*/
public boolean isAjudaDeCusto() {
return ajudaDeCusto;
}
/**
* @param ajudaDeCusto the ajudaDeCusto to set
*/
public void setAjudaDeCusto(boolean ajudaDeCusto) {
this.ajudaDeCusto = ajudaDeCusto;
}
/**
* @return the diaria
*/
public boolean isDiaria() {
return diaria;
}
/**
* @param diaria the diaria to set
*/
public void setDiaria(boolean diaria) {
this.diaria = diaria;
}
/**
* @return the coletiva
*/
public boolean isColetiva() {
return coletiva;
}
/**
* @param coletiva the coletiva to set
*/
public void setColetiva(boolean coletiva) {
this.coletiva = coletiva;
}
/**
* @return the valorDaAjudaDeCusto
*/
public int getValorDaAjudaDeCusto() {
return valorDaAjudaDeCusto;
}
/**
* @param valorDaAjudaDeCusto the valorDaAjudaDeCusto to set
*/
public void setValorDaAjudaDeCusto(int valorDaAjudaDeCusto) {
this.valorDaAjudaDeCusto = valorDaAjudaDeCusto;
}
/**
* @return the valorDaDiaria
*/
public Double getValorDaDiaria() {
return valorDaDiaria;
}
/**
* @param valorDaDiaria the valorDaDiaria to set
*/
public void setValorDaDiaria(Double valorDaDiaria) {
this.valorDaDiaria = valorDaDiaria;
}
/**
* @return the valorDaPassagem
*/
public Double getValorDaPassagem() {
return valorDaPassagem;
}
/**
* @param valorDaPassagem the valorDaPassagem to set
*/
public void setValorDaPassagem(Double valorDaPassagem) {
this.valorDaPassagem = valorDaPassagem;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getCidade() {
return cidade;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Viagem other = (Viagem) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
meu ManagedBean
public class SolicitacaoMB {
private SolicitacaoDAO solicitacaoDAO = new SolicitacaoDAO();
private Solicitacao solicitacao;
private ViagemDAO viagemDAO = new ViagemDAO();
private Viagem viagem;
private PessoaMB pessoaMb = new PessoaMB();
private static final long serialVersionUID = 1L;
public SolicitacaoMB() {
}
public void inserirViagem(){
viagem = new Viagem();
viagemDAO.inserirViagem(viagem);
}
public void setPessoaMb(PessoaMB pessoaMb) {
this.pessoaMb = pessoaMb;
}
public PessoaMB getPessoaMb() {
return pessoaMb;
}
public Solicitacao getSolicitacao() {
return solicitacao;
}
public void setSolicitacao(Solicitacao solicitacao) {
this.solicitacao = solicitacao;
}
minha página de cadastro:
html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head></head>
<body>
<f:view>
<h:form >
<h:outputText value="Solicitacao" />
<br />
<br />
<h:outputText value="Nome da pessoa: " />
<h:outputText value="#{pessoaMB.pessoa.nome}" />
<br />
<br />
<h:outputLabel value="Cidade" for="cidade" />
<h:inputText value="#{solicitacaoMB.viagem.cidade}" id="cidade" />
<br />
<br />
<h:outputLabel value="Periodo" />
<h:inputText value="#{solicitacaoMB.viagem.periodoInicial}" /> a <h:inputText
value="#{solicitacaoMB.viagem.periodoFinal}" />
<br />
<br />
<h:selectBooleanCheckbox value="#{solicitacaoMB.viagem.ajudaDeCusto}" />Ajuda de custo
<br />
<br />
<h:outputLabel value="Valor da Ajuda de Custo:" />
<h:inputText value="#{solicitacaoMB.viagem.valorDaAjudaDeCusto}" />
<br />
<br />
<h:selectBooleanCheckbox value="#{solicitacaoMB.viagem.diaria}" />Diaria
<br />
<br />
<h:outputLabel value="Valor da Diaria:" />
<h:inputText value="#{solicitacaoMB.viagem.valorDaDiaria}" />
<br />
<br />
<h:selectBooleanCheckbox value="#{solicitacaoMB.viagem.coletiva}" />Coletiva
<br />
<br />
<h:outputText value="Justificativa" />
<br />
<h:inputTextarea value="#{solicitacaoMB.viagem.objetivo}" />
<h:selectBooleanCheckbox value="" />Dentro do Estado
<br />
<br />
<h:commandButton action="#{solicitacaoMB.inserirViagem}"
value="Enviar Solicitacao" />
</h:form>
</f:view>
</body>
</html>
Porém isso não funcionou bem.
alguem poderia me da uma ajuda ?Agradeço desde já.
