Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/EjercitarJPA/src/model/Curso.java
diff options
context:
space:
mode:
Diffstat (limited to 'EjercitarJPA/src/model/Curso.java')
-rw-r--r--EjercitarJPA/src/model/Curso.java171
1 files changed, 138 insertions, 33 deletions
diff --git a/EjercitarJPA/src/model/Curso.java b/EjercitarJPA/src/model/Curso.java
index 302ad7c..79eafe0 100644
--- a/EjercitarJPA/src/model/Curso.java
+++ b/EjercitarJPA/src/model/Curso.java
@@ -1,52 +1,157 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
package model;
import java.io.Serializable;
-import javax.persistence.*;
-
+import java.util.List;
+import javax.persistence.Basic;
+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.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the curso database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "CURSO")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Curso.findAll", query = "SELECT c FROM Curso c"),
+ @NamedQuery(name = "Curso.findByIdCurso", query = "SELECT c FROM Curso c WHERE c.idCurso = :idCurso"),
+ @NamedQuery(name = "Curso.findBySeccion", query = "SELECT c FROM Curso c WHERE c.seccion = :seccion"),
+ @NamedQuery(name = "Curso.findByTurno", query = "SELECT c FROM Curso c WHERE c.turno = :turno")})
public class Curso implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_curso")
+ private Integer idCurso;
+ @Size(max = 1)
+ @Column(name = "seccion")
+ private String seccion;
+ @Size(max = 1)
+ @Column(name = "turno")
+ private String turno;
+ @JoinTable(name = "CURSO_PROFESOR", joinColumns = {
+ @JoinColumn(name = "id_curso", referencedColumnName = "id_curso")}, inverseJoinColumns = {
+ @JoinColumn(name = "id_profesor", referencedColumnName = "id_profesor")})
+ @ManyToMany
+ private List<Profesor> profesorList;
+ @OneToMany(mappedBy = "curso", fetch = FetchType.EAGER)
+ private List<Tarea> tareaList;
+ @JoinColumn(name = "id_escuela", referencedColumnName = "id_escuela")
+ @ManyToOne
+ private Escuela idEscuela;
+ @OneToMany(mappedBy = "curso")
+ private List<Alumno> alumnoList;
+
+ public Curso() {
+ }
+
+ public Curso(Integer idCurso) {
+ this.idCurso = idCurso;
+ }
+
+ public Integer getIdCurso() {
+ return idCurso;
+ }
+
+ public void setIdCurso(Integer idCurso) {
+ this.idCurso = idCurso;
+ }
+
+ public String getSeccion() {
+ return seccion;
+ }
+
+ public void setSeccion(String seccion) {
+ this.seccion = seccion;
+ }
+
+ public String getTurno() {
+ return turno;
+ }
+
+ public void setTurno(String turno) {
+ this.turno = turno;
+ }
- @Id
- @Column(name="\"idCurso\"")
- private Integer idCurso;
+ @XmlTransient
+ public List<Profesor> getProfesorList() {
+ return profesorList;
+ }
- @Column(name="\"idEscuela\"")
- private Integer idEscuela;
+ public void setProfesorList(List<Profesor> profesorList) {
+ this.profesorList = profesorList;
+ }
- @Column(name="\"idProfesor\"")
- private Integer idProfesor;
+ @XmlTransient
+ public List<Tarea> getTareaList() {
+ return tareaList;
+ }
- public Curso() {
- }
+ public void setTareaList(List<Tarea> tareaList) {
+ this.tareaList = tareaList;
+ }
- public Integer getIdCurso() {
- return this.idCurso;
- }
+ public Escuela getIdEscuela() {
+ return idEscuela;
+ }
- public void setIdCurso(Integer idCurso) {
- this.idCurso = idCurso;
- }
+ public void setIdEscuela(Escuela idEscuela) {
+ this.idEscuela = idEscuela;
+ }
- public Integer getIdEscuela() {
- return this.idEscuela;
- }
+ @XmlTransient
+ public List<Alumno> getAlumnoList() {
+ return alumnoList;
+ }
- public void setIdEscuela(Integer idEscuela) {
- this.idEscuela = idEscuela;
- }
+ public void setAlumnoList(List<Alumno> alumnoList) {
+ this.alumnoList = alumnoList;
+ }
- public Integer getIdProfesor() {
- return this.idProfesor;
- }
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idCurso != null ? idCurso.hashCode() : 0);
+ return hash;
+ }
- public void setIdProfesor(Integer idProfesor) {
- this.idProfesor = idProfesor;
- }
+ @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 Curso)) {
+ return false;
+ }
+ Curso other = (Curso) object;
+ if ((this.idCurso == null && other.idCurso != null) || (this.idCurso != null && !this.idCurso.equals(other.idCurso))) {
+ return false;
+ }
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "model.Curso[ idCurso=" + idCurso + " ]";
+ }
+
+}