Olá, pessoal!
Estou tentando e aprendendo mais profundidade sobre hibernate, entao tentando para funcionar e ocorreu os erros, veja em baixo.
mensagem de Erro
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: Persistencia.Cliente.reservas
org.hibernate.cfg.annotations.CollectionBinder.getCollectionBinder(CollectionBinder.java:266)
org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1448)
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:754)
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1319)
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
Controlador.IncluirServlet.doGet(IncluirServlet.java:30)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Classe Reservas
@Entity
public class Reserva {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_reserva")
private int idReserva;
@Column(unique=true,nullable=true,insertable=true,updatable=false)
private int codigo;
@Column(name="data_inicio",nullable=true,insertable=true,updatable=true)
@Temporal(TemporalType.DATE)
private Calendar dataInicio;
@Column(name="data_final",nullable=true,insertable=true,updatable=true)
@Temporal(TemporalType.DATE)
private Calendar dataFinal;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_veiculos",insertable=true,updatable=true)
@Fetch(FetchMode.JOIN)
private Veiculos veiculo;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_cliente",insertable=true,updatable=true)
@Fetch(FetchMode.JOIN)
private Cliente cliente;
// getters e setters
Classe Cliente
@Entity
public class Cliente {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_cliente")
private int idCliente;
@Column(insertable=true,nullable=false,updatable=true)
private String nome;
@Column(insertable=true,nullable=false,updatable=true)
private String endereco;
@OneToMany(mappedBy="cliente",fetch=FetchType.LAZY)
@Cascade(CascadeType.ALL)
private ArrayList<Reserva> reservas;
//Getters e Setters
Classe Veiculos
@Entity
public class Veiculos {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_veiculos")
private int idVeiculos;
@Column(length=100,insertable=true,nullable=false,updatable=false)
private String modelo;
@Column(unique=true, nullable=true,insertable=true,updatable=false)
private String placa;
@Column(insertable=true,nullable=true,updatable=false)
private int ano;
@Column(length=15,nullable=true,insertable=true,updatable=false)
private String cor;
@Column(name="data_fabricacao",nullable=true,insertable=true,updatable=false)
@Temporal(TemporalType.DATE)
private Calendar dataFabricacao;
@Column(name="valor_diaria",nullable=true,insertable=true,updatable=false)
private double valorDiaria;
@OneToMany(mappedBy="veiculo",fetch=FetchType.LAZY)
@Cascade(CascadeType.ALL)
private ArrayList<Reserva> reservas;
//Getters e Setters
Espero que me ajudem obrigado!!!