Ao tentar executar o BancoDAOTest.java no JUnit, aparece a seguinte mensagem:
[color=red]Falha ao tentar criar o SessionFactory…org.hibernate.AnnotationException: @Temporal should only be set on a java.util.Date or java.util.Calendar property: com.serginho.domain.NotaCupomFiscal.hr_saida[/color]
package com.serginho.domain;
import java.math.BigDecimal;
import java.sql.Time;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name="nota_cupom_fiscal")
public class NotaCupomFiscal {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@Column(name = "num_nota_cupom_fiscal")
private Long num_nota_cupom_fiscal;
@Temporal(value = TemporalType.DATE)
@Column(name = "dt_emissao")
private Date dt_emissao;
@Temporal(value = TemporalType.DATE)
@Column(name = "dt_saida")
private Date dt_saida;
@Temporal(value = TemporalType.TIME)
@Column(name = "hr_saida")
private Time hr_saida;
@Column(name = "tot_nota_cupom_fiscal", precision = 12, scale = 2, nullable = false)
private BigDecimal tot_nota_cupom_fiscal;
@Column(name = "vlr_cheque_doc_ted", precision = 12, scale = 2, nullable = false)
private BigDecimal vlr_cheque_doc_ted;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "pessoa_id", referencedColumnName = "id")
private Pessoa pessoa;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the num_nota_cupom_fiscal
*/
public Long getNum_nota_cupom_fiscal() {
return num_nota_cupom_fiscal;
}
/**
* @param num_nota_cupom_fiscal the num_nota_cupom_fiscal to set
*/
public void setNum_nota_cupom_fiscal(Long num_nota_cupom_fiscal) {
this.num_nota_cupom_fiscal = num_nota_cupom_fiscal;
}
/**
* @return the dt_emissao
*/
public Date getDt_emissao() {
return dt_emissao;
}
/**
* @param dt_emissao the dt_emissao to set
*/
public void setDt_emissao(Date dt_emissao) {
this.dt_emissao = dt_emissao;
}
/**
* @return the dt_saida
*/
public Date getDt_saida() {
return dt_saida;
}
/**
* @param dt_saida the dt_saida to set
*/
public void setDt_saida(Date dt_saida) {
this.dt_saida = dt_saida;
}
/**
* @return the hr_saida
*/
public Time getHr_saida() {
return hr_saida;
}
/**
* @param hr_saida the hr_saida to set
*/
public void setHr_saida(Time hr_saida) {
this.hr_saida = hr_saida;
}
/**
* @return the tot_nota_cupom_fiscal
*/
public BigDecimal getTot_nota_cupom_fiscal() {
return tot_nota_cupom_fiscal;
}
/**
* @param tot_nota_cupom_fiscal the tot_nota_cupom_fiscal to set
*/
public void setTot_nota_cupom_fiscal(BigDecimal tot_nota_cupom_fiscal) {
this.tot_nota_cupom_fiscal = tot_nota_cupom_fiscal;
}
/**
* @return the vlr_cheque_doc_ted
*/
public BigDecimal getVlr_cheque_doc_ted() {
return vlr_cheque_doc_ted;
}
/**
* @param vlr_cheque_doc_ted the vlr_cheque_doc_ted to set
*/
public void setVlr_cheque_doc_ted(BigDecimal vlr_cheque_doc_ted) {
this.vlr_cheque_doc_ted = vlr_cheque_doc_ted;
}
/**
* @return the pessoa
*/
public Pessoa getPessoa() {
return pessoa;
}
/**
* @param pessoa the pessoa to set
*/
public void setPessoa(Pessoa pessoa) {
this.pessoa = pessoa;
}
}
Utilizo:
MySQL 5.6.21 (InnoDB)
Hibernate 4.3.8