/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pepe.jpa.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Junior Cabal
*/
@Entity
@Table(name = "evento")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Evento.findAll", query = "SELECT e FROM Evento e"),
@NamedQuery(name = "Evento.findByIdEvento", query = "SELECT e FROM Evento e WHERE e.idEvento = :idEvento"),
@NamedQuery(name = "Evento.findByFechaInicio", query = "SELECT e FROM Evento e WHERE e.fechaInicio = :fechaInicio"),
@NamedQuery(name = "Evento.findByFechaFin", query = "SELECT e FROM Evento e WHERE e.fechaFin = :fechaFin")})
public class Evento implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id_evento")
private Integer idEvento;
@Basic(optional = false)
@NotNull
@Column(name = "fecha_inicio")
@Temporal(TemporalType.TIMESTAMP)
private Date fechaInicio;
@Basic(optional = false)
@NotNull
@Column(name = "fecha_fin")
@Temporal(TemporalType.TIMESTAMP)
private Date fechaFin;
@JoinColumn(name = "id_ambiente_formacion", referencedColumnName = "id_ambiente_formacion")
@ManyToOne(optional = false)
private AmbienteFormacion idAmbienteFormacion;
@JoinColumn(name = "id_programador", referencedColumnName = "id_programador")
@ManyToOne(optional = false)
private Programador idProgramador;
public Evento() {
}
public Evento(Integer idEvento) {
this.idEvento = idEvento;
}
public Evento(Integer idEvento, Date fechaInicio, Date fechaFin) {
this.idEvento = idEvento;
this.fechaInicio = fechaInicio;
this.fechaFin = fechaFin;
}
public Integer getIdEvento() {
return idEvento;
}
public void setIdEvento(Integer idEvento) {
this.idEvento = idEvento;
}
public Date getFechaInicio() {
return fechaInicio;
}
public void setFechaInicio(Date fechaInicio) {
this.fechaInicio = fechaInicio;
}
public Date getFechaFin() {
return fechaFin;
}
public void setFechaFin(Date fechaFin) {
this.fechaFin = fechaFin;
}
public AmbienteFormacion getIdAmbienteFormacion() {
return idAmbienteFormacion;
}
public void setIdAmbienteFormacion(AmbienteFormacion idAmbienteFormacion) {
this.idAmbienteFormacion = idAmbienteFormacion;
}
public Programador getIdProgramador() {
return idProgramador;
}
public void setIdProgramador(Programador idProgramador) {
this.idProgramador = idProgramador;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idEvento != null ? idEvento.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Evento)) {
return false;
}
Evento other = (Evento) object;
if ((this.idEvento == null && other.idEvento != null) || (this.idEvento != null && !this.idEvento.equals(other.idEvento))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.pepe.jpa.entities.Evento[ idEvento=" + idEvento + " ]";
}
}