Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/EjercitarJPA/src
diff options
context:
space:
mode:
Diffstat (limited to 'EjercitarJPA/src')
-rw-r--r--EjercitarJPA/src/META-INF/persistence.xml7
-rw-r--r--EjercitarJPA/src/model/Alumno.java269
-rw-r--r--EjercitarJPA/src/model/Asignatura.java129
-rw-r--r--EjercitarJPA/src/model/Concepto.java155
-rw-r--r--EjercitarJPA/src/model/Curso.java171
-rw-r--r--EjercitarJPA/src/model/Ejercicio.java250
-rw-r--r--EjercitarJPA/src/model/EjercicioResueltoAlumno.java116
-rw-r--r--EjercitarJPA/src/model/Escuela.java214
-rw-r--r--EjercitarJPA/src/model/Profesor.java206
-rw-r--r--EjercitarJPA/src/model/Respuesta.java132
-rw-r--r--EjercitarJPA/src/model/Sesion.java190
-rw-r--r--EjercitarJPA/src/model/Tarea.java139
-rw-r--r--EjercitarJPA/src/model/Tema.java184
13 files changed, 1665 insertions, 497 deletions
diff --git a/EjercitarJPA/src/META-INF/persistence.xml b/EjercitarJPA/src/META-INF/persistence.xml
index 13dec83..390a351 100644
--- a/EjercitarJPA/src/META-INF/persistence.xml
+++ b/EjercitarJPA/src/META-INF/persistence.xml
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
- <persistence-unit name="EjercitarJPA">
- <class>model.Ejercicio</class>
+ <persistence-unit name="EjercitarJPA" transaction-type="JTA">
+ <jta-data-source>java:/EjercitarDS</jta-data-source>
<class>model.Alumno</class>
<class>model.Concepto</class>
<class>model.Curso</class>
+ <class>model.Ejercicio</class>
<class>model.Escuela</class>
<class>model.Profesor</class>
<class>model.Respuesta</class>
<class>model.Sesion</class>
<class>model.Tarea</class>
<class>model.Tema</class>
+ <class>model.Asignatura</class>
+ <class>model.EjercicioResueltoAlumno</class>
</persistence-unit>
</persistence>
diff --git a/EjercitarJPA/src/model/Alumno.java b/EjercitarJPA/src/model/Alumno.java
index 2265447..d84bd1e 100644
--- a/EjercitarJPA/src/model/Alumno.java
+++ b/EjercitarJPA/src/model/Alumno.java
@@ -1,94 +1,191 @@
+/*
+ * 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.Date;
-
+import java.util.Date;
+import java.util.List;
+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.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.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the alumno database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "ALUMNO")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Alumno.findAll", query = "SELECT a FROM Alumno a"),
+ @NamedQuery(name = "Alumno.findByIdAlumno", query = "SELECT a FROM Alumno a WHERE a.idAlumno = :idAlumno"),
+ @NamedQuery(name = "Alumno.findBySerial", query = "SELECT a FROM Alumno a WHERE a.serial = :serial"),
+ @NamedQuery(name = "Alumno.findByNombre", query = "SELECT a FROM Alumno a WHERE a.nombre = :nombre"),
+ @NamedQuery(name = "Alumno.findByApellido", query = "SELECT a FROM Alumno a WHERE a.apellido = :apellido"),
+ @NamedQuery(name = "Alumno.findByFechaNacimiento", query = "SELECT a FROM Alumno a WHERE a.fechaNacimiento = :fechaNacimiento"),
+ @NamedQuery(name = "Alumno.findByGenero", query = "SELECT a FROM Alumno a WHERE a.genero = :genero")})
public class Alumno implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name="\"idAlumno\"")
- private Integer idAlumno;
-
- private String apellido;
-
- private Integer cedula;
-
- @Temporal(TemporalType.DATE)
- @Column(name="fecha_nacimiento")
- private Date fechaNacimiento;
-
- private String genero;
-
- @Column(name="\"idCurso\"")
- private Integer idCurso;
-
- private String nombre;
-
- public Alumno() {
- }
-
- public Integer getIdAlumno() {
- return this.idAlumno;
- }
-
- public void setIdAlumno(Integer idAlumno) {
- this.idAlumno = idAlumno;
- }
-
- public String getApellido() {
- return this.apellido;
- }
-
- public void setApellido(String apellido) {
- this.apellido = apellido;
- }
-
- public Integer getCedula() {
- return this.cedula;
- }
-
- public void setCedula(Integer cedula) {
- this.cedula = cedula;
- }
-
- public Date getFechaNacimiento() {
- return this.fechaNacimiento;
- }
-
- public void setFechaNacimiento(Date fechaNacimiento) {
- this.fechaNacimiento = fechaNacimiento;
- }
-
- public String getGenero() {
- return this.genero;
- }
-
- public void setGenero(String genero) {
- this.genero = genero;
- }
-
- public Integer getIdCurso() {
- return this.idCurso;
- }
-
- public void setIdCurso(Integer idCurso) {
- this.idCurso = idCurso;
- }
-
- public String getNombre() {
- return this.nombre;
- }
-
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
-
-} \ No newline at end of file
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_alumno")
+ private Integer idAlumno;
+ @Basic(optional = false)
+ @NotNull
+ @Column(name = "serial")
+ private int serial;
+ @Size(max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Size(max = 2147483647)
+ @Column(name = "apellido")
+ private String apellido;
+ @Column(name = "fecha_nacimiento")
+ @Temporal(TemporalType.DATE)
+ private Date fechaNacimiento;
+ @Size(max = 1)
+ @Column(name = "genero")
+ private String genero;
+ @JoinTable(name = "ALUMNO_SESION", joinColumns = {
+ @JoinColumn(name = "id_alumno", referencedColumnName = "id_alumno")}, inverseJoinColumns = {
+ @JoinColumn(name = "id_sesion", referencedColumnName = "id_sesion")})
+ @ManyToMany
+ private List<Sesion> sesionList;
+ @OneToMany(mappedBy = "idAlumno")
+ private List<EjercicioResueltoAlumno> ejercicioResueltoAlumnoList;
+ @JoinColumn(name = "id_curso", referencedColumnName = "id_curso")
+ @ManyToOne
+ private Curso curso;
+
+ public Alumno() {
+ }
+
+ public Alumno(Integer idAlumno) {
+ this.idAlumno = idAlumno;
+ }
+
+ public Alumno(Integer idAlumno, int serial) {
+ this.idAlumno = idAlumno;
+ this.serial = serial;
+ }
+
+ public Integer getIdAlumno() {
+ return idAlumno;
+ }
+
+ public void setIdAlumno(Integer idAlumno) {
+ this.idAlumno = idAlumno;
+ }
+
+ public int getSerial() {
+ return serial;
+ }
+
+ public void setSerial(int serial) {
+ this.serial = serial;
+ }
+
+ public String getNombre() {
+ return nombre;
+ }
+
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
+
+ public String getApellido() {
+ return apellido;
+ }
+
+ public void setApellido(String apellido) {
+ this.apellido = apellido;
+ }
+
+ public Date getFechaNacimiento() {
+ return fechaNacimiento;
+ }
+
+ public void setFechaNacimiento(Date fechaNacimiento) {
+ this.fechaNacimiento = fechaNacimiento;
+ }
+
+ public String getGenero() {
+ return genero;
+ }
+
+ public void setGenero(String genero) {
+ this.genero = genero;
+ }
+
+ @XmlTransient
+ public List<Sesion> getSesionList() {
+ return sesionList;
+ }
+
+ public void setSesionList(List<Sesion> sesionList) {
+ this.sesionList = sesionList;
+ }
+
+ @XmlTransient
+ public List<EjercicioResueltoAlumno> getEjercicioResueltoAlumnoList() {
+ return ejercicioResueltoAlumnoList;
+ }
+
+ public void setEjercicioResueltoAlumnoList(List<EjercicioResueltoAlumno> ejercicioResueltoAlumnoList) {
+ this.ejercicioResueltoAlumnoList = ejercicioResueltoAlumnoList;
+ }
+
+ public Curso getCurso() {
+ return curso;
+ }
+
+ public void setCurso(Curso curso) {
+ this.curso = curso;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idAlumno != null ? idAlumno.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 Alumno)) {
+ return false;
+ }
+ Alumno other = (Alumno) object;
+ if ((this.idAlumno == null && other.idAlumno != null) || (this.idAlumno != null && !this.idAlumno.equals(other.idAlumno))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Alumno[ idAlumno=" + idAlumno + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Asignatura.java b/EjercitarJPA/src/model/Asignatura.java
new file mode 100644
index 0000000..de5fc9d
--- /dev/null
+++ b/EjercitarJPA/src/model/Asignatura.java
@@ -0,0 +1,129 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package model;
+
+import java.io.Serializable;
+import java.util.List;
+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.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ *
+ * @author Ceci
+ */
+@Entity
+@Table(name = "ASIGNATURA")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Asignatura.findAll", query = "SELECT a FROM Asignatura a"),
+ @NamedQuery(name = "Asignatura.findByIdAsignatura", query = "SELECT a FROM Asignatura a WHERE a.idAsignatura = :idAsignatura"),
+ @NamedQuery(name = "Asignatura.findByNombre", query = "SELECT a FROM Asignatura a WHERE a.nombre = :nombre"),
+ @NamedQuery(name = "Asignatura.findByDescripcion", query = "SELECT a FROM Asignatura a WHERE a.descripcion = :descripcion")})
+public class Asignatura implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_asignatura")
+ private Integer idAsignatura;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Size(max = 2147483647)
+ @Column(name = "descripcion")
+ private String descripcion;
+ @JoinTable(name = "PROFESOR_ASIGNATURA", joinColumns = {
+ @JoinColumn(name = "id_asignatura", referencedColumnName = "id_asignatura")}, inverseJoinColumns = {
+ @JoinColumn(name = "id_profesor", referencedColumnName = "id_profesor")})
+ @ManyToMany
+ private List<Profesor> profesorList;
+
+ public Asignatura() {
+ }
+
+ public Asignatura(Integer idAsignatura) {
+ this.idAsignatura = idAsignatura;
+ }
+
+ public Asignatura(Integer idAsignatura, String nombre) {
+ this.idAsignatura = idAsignatura;
+ this.nombre = nombre;
+ }
+
+ public Integer getIdAsignatura() {
+ return idAsignatura;
+ }
+
+ public void setIdAsignatura(Integer idAsignatura) {
+ this.idAsignatura = idAsignatura;
+ }
+
+ public String getNombre() {
+ return nombre;
+ }
+
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
+
+ public String getDescripcion() {
+ return descripcion;
+ }
+
+ public void setDescripcion(String descripcion) {
+ this.descripcion = descripcion;
+ }
+
+ @XmlTransient
+ public List<Profesor> getProfesorList() {
+ return profesorList;
+ }
+
+ public void setProfesorList(List<Profesor> profesorList) {
+ this.profesorList = profesorList;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idAsignatura != null ? idAsignatura.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 Asignatura)) {
+ return false;
+ }
+ Asignatura other = (Asignatura) object;
+ if ((this.idAsignatura == null && other.idAsignatura != null) || (this.idAsignatura != null && !this.idAsignatura.equals(other.idAsignatura))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Asignatura[ idAsignatura=" + idAsignatura + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Concepto.java b/EjercitarJPA/src/model/Concepto.java
index ade496b..af2e8b9 100644
--- a/EjercitarJPA/src/model/Concepto.java
+++ b/EjercitarJPA/src/model/Concepto.java
@@ -1,49 +1,144 @@
+/*
+ * 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.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the concepto database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "CONCEPTO")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Concepto.findAll", query = "SELECT c FROM Concepto c"),
+ @NamedQuery(name = "Concepto.findByIdConcepto", query = "SELECT c FROM Concepto c WHERE c.idConcepto = :idConcepto"),
+ @NamedQuery(name = "Concepto.findByNombre", query = "SELECT c FROM Concepto c WHERE c.nombre = :nombre"),
+ @NamedQuery(name = "Concepto.findByDescripcion", query = "SELECT c FROM Concepto c WHERE c.descripcion = :descripcion")})
public class Concepto 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_concepto")
+ private Integer idConcepto;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "descripcion")
+ private String descripcion;
+ @JoinTable(name = "EJERCICIO_CONCEPTO", joinColumns = {
+ @JoinColumn(name = "id_concepto", referencedColumnName = "id_concepto")}, inverseJoinColumns = {
+ @JoinColumn(name = "id_ejercicio", referencedColumnName = "id_ejercicio")})
+ @ManyToMany
+ private List<Ejercicio> ejercicioList;
+ @OneToMany(mappedBy = "idConcepto")
+ private List<Tema> temaList;
+
+ public Concepto() {
+ }
+
+ public Concepto(Integer idConcepto) {
+ this.idConcepto = idConcepto;
+ }
+
+ public Concepto(Integer idConcepto, String nombre, String descripcion) {
+ this.idConcepto = idConcepto;
+ this.nombre = nombre;
+ this.descripcion = descripcion;
+ }
+
+ public Integer getIdConcepto() {
+ return idConcepto;
+ }
+
+ public void setIdConcepto(Integer idConcepto) {
+ this.idConcepto = idConcepto;
+ }
- @Id
- private Integer idconcepto;
+ public String getNombre() {
+ return nombre;
+ }
- private String descripcion;
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
- private String nombre;
+ public String getDescripcion() {
+ return descripcion;
+ }
- public Concepto() {
- }
+ public void setDescripcion(String descripcion) {
+ this.descripcion = descripcion;
+ }
- public Integer getIdconcepto() {
- return this.idconcepto;
- }
+ @XmlTransient
+ public List<Ejercicio> getEjercicioList() {
+ return ejercicioList;
+ }
- public void setIdconcepto(Integer idconcepto) {
- this.idconcepto = idconcepto;
- }
+ public void setEjercicioList(List<Ejercicio> ejercicioList) {
+ this.ejercicioList = ejercicioList;
+ }
- public String getDescripcion() {
- return this.descripcion;
- }
+ @XmlTransient
+ public List<Tema> getTemaList() {
+ return temaList;
+ }
- public void setDescripcion(String descripcion) {
- this.descripcion = descripcion;
- }
+ public void setTemaList(List<Tema> temaList) {
+ this.temaList = temaList;
+ }
- public String getNombre() {
- return this.nombre;
- }
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idConcepto != null ? idConcepto.hashCode() : 0);
+ return hash;
+ }
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
+ @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 Concepto)) {
+ return false;
+ }
+ Concepto other = (Concepto) object;
+ if ((this.idConcepto == null && other.idConcepto != null) || (this.idConcepto != null && !this.idConcepto.equals(other.idConcepto))) {
+ return false;
+ }
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "model.Concepto[ idConcepto=" + idConcepto + " ]";
+ }
+
+}
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 + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Ejercicio.java b/EjercitarJPA/src/model/Ejercicio.java
index aa47e76..afda88c 100644
--- a/EjercitarJPA/src/model/Ejercicio.java
+++ b/EjercitarJPA/src/model/Ejercicio.java
@@ -1,72 +1,194 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+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.Lob;
+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.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the "Ejercicio" database table.
- *
+ *
+ * @author Ceci
*/
@Entity
-@Table(name="\"Ejercicio\"")
+@Table(name = "EJERCICIO")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Ejercicio.findAll", query = "SELECT e FROM Ejercicio e"),
+ @NamedQuery(name = "Ejercicio.findByIdEjercicio", query = "SELECT e FROM Ejercicio e WHERE e.idEjercicio = :idEjercicio"),
+ @NamedQuery(name = "Ejercicio.findByEnunciado", query = "SELECT e FROM Ejercicio e WHERE e.enunciado = :enunciado"),
+ @NamedQuery(name = "Ejercicio.findByNivelDificultad", query = "SELECT e FROM Ejercicio e WHERE e.nivelDificultad = :nivelDificultad"),
+ @NamedQuery(name = "Ejercicio.findByTitulo", query = "SELECT e FROM Ejercicio e WHERE e.titulo = :titulo")})
public class Ejercicio implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name="\"idEjercicio\"")
- private Integer idEjercicio;
-
- private Integer dificultad;
-
- private String enunciado;
-
- private byte[] imagen;
-
- @Column(name="repuesta_correcta")
- private String repuestaCorrecta;
-
- public Ejercicio() {
- }
-
- public Integer getIdEjercicio() {
- return this.idEjercicio;
- }
-
- public void setIdEjercicio(Integer idEjercicio) {
- this.idEjercicio = idEjercicio;
- }
-
- public Integer getDificultad() {
- return this.dificultad;
- }
-
- public void setDificultad(Integer dificultad) {
- this.dificultad = dificultad;
- }
-
- public String getEnunciado() {
- return this.enunciado;
- }
-
- public void setEnunciado(String enunciado) {
- this.enunciado = enunciado;
- }
-
- public byte[] getImagen() {
- return this.imagen;
- }
-
- public void setImagen(byte[] imagen) {
- this.imagen = imagen;
- }
-
- public String getRepuestaCorrecta() {
- return this.repuestaCorrecta;
- }
-
- public void setRepuestaCorrecta(String repuestaCorrecta) {
- this.repuestaCorrecta = repuestaCorrecta;
- }
-
-} \ No newline at end of file
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_ejercicio")
+ private Integer idEjercicio;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "enunciado")
+ private String enunciado;
+ @Lob
+ @Column(name = "imagen")
+ private byte[] imagen;
+ @Column(name = "nivel_dificultad")
+ private Integer nivelDificultad;
+ @Size(max = 2147483647)
+ @Column(name = "titulo")
+ private String titulo;
+ @JoinTable(name = "RESPUESTA_EJERCICIO", joinColumns = {
+ @JoinColumn(name = "id_ejercicio", referencedColumnName = "id_ejercicio")}, inverseJoinColumns = {
+ @JoinColumn(name = "id_respuesta", referencedColumnName = "id_respuesta")})
+ @ManyToMany()
+ @XmlElementWrapper
+ private Collection<Respuesta> respuestaList;
+ @ManyToMany(mappedBy = "ejercicioList")
+ private List<Concepto> conceptoList;
+ @OneToMany(mappedBy = "idEjercicio")
+ private List<EjercicioResueltoAlumno> ejercicioResueltoAlumnoList;
+ @JoinColumn(name = "id_respuesta", referencedColumnName = "id_respuesta")
+ @ManyToOne
+ private Respuesta idRespuesta;
+
+ public Ejercicio() {
+ }
+
+ public Ejercicio(Integer idEjercicio) {
+ this.idEjercicio = idEjercicio;
+ }
+
+ public Ejercicio(Integer idEjercicio, String enunciado) {
+ this.idEjercicio = idEjercicio;
+ this.enunciado = enunciado;
+ }
+
+ public Integer getIdEjercicio() {
+ return idEjercicio;
+ }
+
+ public void setIdEjercicio(Integer idEjercicio) {
+ this.idEjercicio = idEjercicio;
+ }
+
+ public String getEnunciado() {
+ return enunciado;
+ }
+
+ public void setEnunciado(String enunciado) {
+ this.enunciado = enunciado;
+ }
+
+ public byte[] getImagen() {
+ return imagen;
+ }
+
+ public void setImagen(byte[] imagen) {
+ this.imagen = imagen;
+ }
+
+ public Integer getNivelDificultad() {
+ return nivelDificultad;
+ }
+
+ public void setNivelDificultad(Integer nivelDificultad) {
+ this.nivelDificultad = nivelDificultad;
+ }
+
+ public String getTitulo() {
+ return titulo;
+ }
+
+ public void setTitulo(String titulo) {
+ this.titulo = titulo;
+ }
+
+ @XmlTransient
+ public Collection<Respuesta> getRespuestaList() {
+ return new ArrayList<Respuesta>(respuestaList);
+ }
+
+ public void setRespuestaList(Collection<Respuesta> respuestaList) {
+ this.respuestaList = respuestaList;
+ }
+
+ @XmlTransient
+ public List<Concepto> getConceptoList() {
+ return conceptoList;
+ }
+
+ public void setConceptoList(List<Concepto> conceptoList) {
+ this.conceptoList = conceptoList;
+ }
+
+ @XmlTransient
+ public List<EjercicioResueltoAlumno> getEjercicioResueltoAlumnoList() {
+ return ejercicioResueltoAlumnoList;
+ }
+
+ public void setEjercicioResueltoAlumnoList(List<EjercicioResueltoAlumno> ejercicioResueltoAlumnoList) {
+ this.ejercicioResueltoAlumnoList = ejercicioResueltoAlumnoList;
+ }
+
+ public Respuesta getIdRespuesta() {
+ return idRespuesta;
+ }
+
+ public void setIdRespuesta(Respuesta idRespuesta) {
+ this.idRespuesta = idRespuesta;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idEjercicio != null ? idEjercicio.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 Ejercicio)) {
+ return false;
+ }
+ Ejercicio other = (Ejercicio) object;
+ if ((this.idEjercicio == null && other.idEjercicio != null) || (this.idEjercicio != null && !this.idEjercicio.equals(other.idEjercicio))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Ejercicio[ idEjercicio=" + idEjercicio + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/EjercicioResueltoAlumno.java b/EjercitarJPA/src/model/EjercicioResueltoAlumno.java
new file mode 100644
index 0000000..e0d56c2
--- /dev/null
+++ b/EjercitarJPA/src/model/EjercicioResueltoAlumno.java
@@ -0,0 +1,116 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package model;
+
+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.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Ceci
+ */
+@Entity
+@Table(name = "EJERCICIO_RESUELTO_ALUMNO")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "EjercicioResueltoAlumno.findAll", query = "SELECT e FROM EjercicioResueltoAlumno e"),
+ @NamedQuery(name = "EjercicioResueltoAlumno.findByIdEjercicioResueltoAlumno", query = "SELECT e FROM EjercicioResueltoAlumno e WHERE e.idEjercicioResueltoAlumno = :idEjercicioResueltoAlumno"),
+ @NamedQuery(name = "EjercicioResueltoAlumno.findByFecha", query = "SELECT e FROM EjercicioResueltoAlumno e WHERE e.fecha = :fecha")})
+public class EjercicioResueltoAlumno implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_ejercicio_resuelto_alumno")
+ private Integer idEjercicioResueltoAlumno;
+ @Column(name = "fecha")
+ @Temporal(TemporalType.DATE)
+ private Date fecha;
+ @JoinColumn(name = "id_ejercicio", referencedColumnName = "id_ejercicio")
+ @ManyToOne
+ private Ejercicio idEjercicio;
+ @JoinColumn(name = "id_alumno", referencedColumnName = "id_alumno")
+ @ManyToOne
+ private Alumno idAlumno;
+
+ public EjercicioResueltoAlumno() {
+ }
+
+ public EjercicioResueltoAlumno(Integer idEjercicioResueltoAlumno) {
+ this.idEjercicioResueltoAlumno = idEjercicioResueltoAlumno;
+ }
+
+ public Integer getIdEjercicioResueltoAlumno() {
+ return idEjercicioResueltoAlumno;
+ }
+
+ public void setIdEjercicioResueltoAlumno(Integer idEjercicioResueltoAlumno) {
+ this.idEjercicioResueltoAlumno = idEjercicioResueltoAlumno;
+ }
+
+ public Date getFecha() {
+ return fecha;
+ }
+
+ public void setFecha(Date fecha) {
+ this.fecha = fecha;
+ }
+
+ public Ejercicio getIdEjercicio() {
+ return idEjercicio;
+ }
+
+ public void setIdEjercicio(Ejercicio idEjercicio) {
+ this.idEjercicio = idEjercicio;
+ }
+
+ public Alumno getIdAlumno() {
+ return idAlumno;
+ }
+
+ public void setIdAlumno(Alumno idAlumno) {
+ this.idAlumno = idAlumno;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idEjercicioResueltoAlumno != null ? idEjercicioResueltoAlumno.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 EjercicioResueltoAlumno)) {
+ return false;
+ }
+ EjercicioResueltoAlumno other = (EjercicioResueltoAlumno) object;
+ if ((this.idEjercicioResueltoAlumno == null && other.idEjercicioResueltoAlumno != null) || (this.idEjercicioResueltoAlumno != null && !this.idEjercicioResueltoAlumno.equals(other.idEjercicioResueltoAlumno))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.EjercicioResueltoAlumno[ idEjercicioResueltoAlumno=" + idEjercicioResueltoAlumno + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Escuela.java b/EjercitarJPA/src/model/Escuela.java
index b699396..8d42d65 100644
--- a/EjercitarJPA/src/model/Escuela.java
+++ b/EjercitarJPA/src/model/Escuela.java
@@ -1,83 +1,147 @@
+/*
+ * 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 java.util.List;
+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.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the escuela database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "ESCUELA")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Escuela.findAll", query = "SELECT e FROM Escuela e"),
+ @NamedQuery(name = "Escuela.findByIdEscuela", query = "SELECT e FROM Escuela e WHERE e.idEscuela = :idEscuela"),
+ @NamedQuery(name = "Escuela.findByNombre", query = "SELECT e FROM Escuela e WHERE e.nombre = :nombre"),
+ @NamedQuery(name = "Escuela.findByRegistroMec", query = "SELECT e FROM Escuela e WHERE e.registroMec = :registroMec"),
+ @NamedQuery(name = "Escuela.findByDireccion", query = "SELECT e FROM Escuela e WHERE e.direccion = :direccion"),
+ @NamedQuery(name = "Escuela.findByPublica", query = "SELECT e FROM Escuela e WHERE e.publica = :publica")})
public class Escuela implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name="\"idEscuela\"")
- private Integer idEscuela;
-
- private String direccion;
-
- private String nombre;
-
- private String registro;
-
- private String tipo;
-
- //bi-directional many-to-one association to Profesor
- @OneToMany(mappedBy="escuela")
- private List<Profesor> profesors;
-
- public Escuela() {
- }
-
- public Integer getIdEscuela() {
- return this.idEscuela;
- }
-
- public void setIdEscuela(Integer idEscuela) {
- this.idEscuela = idEscuela;
- }
-
- public String getDireccion() {
- return this.direccion;
- }
-
- public void setDireccion(String direccion) {
- this.direccion = direccion;
- }
-
- public String getNombre() {
- return this.nombre;
- }
-
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
-
- public String getRegistro() {
- return this.registro;
- }
-
- public void setRegistro(String registro) {
- this.registro = registro;
- }
-
- public String getTipo() {
- return this.tipo;
- }
-
- public void setTipo(String tipo) {
- this.tipo = tipo;
- }
-
- public List<Profesor> getProfesors() {
- return this.profesors;
- }
-
- public void setProfesors(List<Profesor> profesors) {
- this.profesors = profesors;
- }
-
-} \ No newline at end of file
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_escuela")
+ private Integer idEscuela;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Size(max = 2147483647)
+ @Column(name = "registro_mec")
+ private String registroMec;
+ @Size(max = 2147483647)
+ @Column(name = "direccion")
+ private String direccion;
+ @Column(name = "publica")
+ private Boolean publica;
+ @OneToMany(mappedBy = "idEscuela")
+ private List<Curso> cursoList;
+
+ public Escuela() {
+ }
+
+ public Escuela(Integer idEscuela) {
+ this.idEscuela = idEscuela;
+ }
+
+ public Escuela(Integer idEscuela, String nombre) {
+ this.idEscuela = idEscuela;
+ this.nombre = nombre;
+ }
+
+ public Integer getIdEscuela() {
+ return idEscuela;
+ }
+
+ public void setIdEscuela(Integer idEscuela) {
+ this.idEscuela = idEscuela;
+ }
+
+ public String getNombre() {
+ return nombre;
+ }
+
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
+
+ public String getRegistroMec() {
+ return registroMec;
+ }
+
+ public void setRegistroMec(String registroMec) {
+ this.registroMec = registroMec;
+ }
+
+ public String getDireccion() {
+ return direccion;
+ }
+
+ public void setDireccion(String direccion) {
+ this.direccion = direccion;
+ }
+
+ public Boolean getPublica() {
+ return publica;
+ }
+
+ public void setPublica(Boolean publica) {
+ this.publica = publica;
+ }
+
+ @XmlTransient
+ public List<Curso> getCursoList() {
+ return cursoList;
+ }
+
+ public void setCursoList(List<Curso> cursoList) {
+ this.cursoList = cursoList;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idEscuela != null ? idEscuela.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 Escuela)) {
+ return false;
+ }
+ Escuela other = (Escuela) object;
+ if ((this.idEscuela == null && other.idEscuela != null) || (this.idEscuela != null && !this.idEscuela.equals(other.idEscuela))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Escuela[ idEscuela=" + idEscuela + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Profesor.java b/EjercitarJPA/src/model/Profesor.java
index bfd1553..60d757a 100644
--- a/EjercitarJPA/src/model/Profesor.java
+++ b/EjercitarJPA/src/model/Profesor.java
@@ -1,70 +1,152 @@
+/*
+ * 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.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the profesor database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "PROFESOR")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Profesor.findAll", query = "SELECT p FROM Profesor p"),
+ @NamedQuery(name = "Profesor.findByIdProfesor", query = "SELECT p FROM Profesor p WHERE p.idProfesor = :idProfesor"),
+ @NamedQuery(name = "Profesor.findByNombre", query = "SELECT p FROM Profesor p WHERE p.nombre = :nombre"),
+ @NamedQuery(name = "Profesor.findByApellido", query = "SELECT p FROM Profesor p WHERE p.apellido = :apellido"),
+ @NamedQuery(name = "Profesor.findByCedula", query = "SELECT p FROM Profesor p WHERE p.cedula = :cedula")})
public class Profesor implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name="\"idProfesor\"")
- private Integer idProfesor;
-
- private String apellido;
-
- private Integer cedula;
-
- private String grado;
-
- private String nombre;
-
- public Profesor() {
- }
-
- public Integer getIdProfesor() {
- return this.idProfesor;
- }
-
- public void setIdProfesor(Integer idProfesor) {
- this.idProfesor = idProfesor;
- }
-
- public String getApellido() {
- return this.apellido;
- }
-
- public void setApellido(String apellido) {
- this.apellido = apellido;
- }
-
- public Integer getCedula() {
- return this.cedula;
- }
-
- public void setCedula(Integer cedula) {
- this.cedula = cedula;
- }
-
- public String getGrado() {
- return this.grado;
- }
-
- public void setGrado(String grado) {
- this.grado = grado;
- }
-
- public String getNombre() {
- return this.nombre;
- }
-
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
-
-} \ No newline at end of file
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_profesor")
+ private Integer idProfesor;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "apellido")
+ private String apellido;
+ @Basic(optional = false)
+ @NotNull
+ @Column(name = "cedula")
+ private int cedula;
+ @ManyToMany(mappedBy = "profesorList")
+ private List<Asignatura> asignaturaList;
+ @ManyToMany(mappedBy = "profesorList")
+ private List<Curso> cursoList;
+
+ public Profesor() {
+ }
+
+ public Profesor(Integer idProfesor) {
+ this.idProfesor = idProfesor;
+ }
+
+ public Profesor(Integer idProfesor, String nombre, String apellido, int cedula) {
+ this.idProfesor = idProfesor;
+ this.nombre = nombre;
+ this.apellido = apellido;
+ this.cedula = cedula;
+ }
+
+ public Integer getIdProfesor() {
+ return idProfesor;
+ }
+
+ public void setIdProfesor(Integer idProfesor) {
+ this.idProfesor = idProfesor;
+ }
+
+ public String getNombre() {
+ return nombre;
+ }
+
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
+
+ public String getApellido() {
+ return apellido;
+ }
+
+ public void setApellido(String apellido) {
+ this.apellido = apellido;
+ }
+
+ public int getCedula() {
+ return cedula;
+ }
+
+ public void setCedula(int cedula) {
+ this.cedula = cedula;
+ }
+
+ @XmlTransient
+ public List<Asignatura> getAsignaturaList() {
+ return asignaturaList;
+ }
+
+ public void setAsignaturaList(List<Asignatura> asignaturaList) {
+ this.asignaturaList = asignaturaList;
+ }
+
+ @XmlTransient
+ public List<Curso> getCursoList() {
+ return cursoList;
+ }
+
+ public void setCursoList(List<Curso> cursoList) {
+ this.cursoList = cursoList;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idProfesor != null ? idProfesor.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 Profesor)) {
+ return false;
+ }
+ Profesor other = (Profesor) object;
+ if ((this.idProfesor == null && other.idProfesor != null) || (this.idProfesor != null && !this.idProfesor.equals(other.idProfesor))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Profesor[ idProfesor=" + idProfesor + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Respuesta.java b/EjercitarJPA/src/model/Respuesta.java
index 0c648c2..079d8a6 100644
--- a/EjercitarJPA/src/model/Respuesta.java
+++ b/EjercitarJPA/src/model/Respuesta.java
@@ -1,40 +1,124 @@
+/*
+ * 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.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the respuesta database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "RESPUESTA")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Respuesta.findAll", query = "SELECT r FROM Respuesta r"),
+ @NamedQuery(name = "Respuesta.findByIdRespuesta", query = "SELECT r FROM Respuesta r WHERE r.idRespuesta = :idRespuesta"),
+ @NamedQuery(name = "Respuesta.findByDescripcion", query = "SELECT r FROM Respuesta r WHERE r.descripcion = :descripcion")})
public class Respuesta 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_respuesta")
+ private Integer idRespuesta;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "descripcion")
+ private String descripcion;
+ @ManyToMany(mappedBy = "respuestaList")
+ private List<Ejercicio> ejercicioList;
+ @OneToMany(mappedBy = "idRespuesta")
+ private List<Ejercicio> ejercicioList1;
+
+ public Respuesta() {
+ }
+
+ public Respuesta(Integer idRespuesta) {
+ this.idRespuesta = idRespuesta;
+ }
+
+ public Respuesta(Integer idRespuesta, String descripcion) {
+ this.idRespuesta = idRespuesta;
+ this.descripcion = descripcion;
+ }
+
+ public Integer getIdRespuesta() {
+ return idRespuesta;
+ }
+
+ public void setIdRespuesta(Integer idRespuesta) {
+ this.idRespuesta = idRespuesta;
+ }
+
+ public String getDescripcion() {
+ return descripcion;
+ }
- @Id
- @Column(name="\"idRespuesta\"")
- private Integer idRespuesta;
+ public void setDescripcion(String descripcion) {
+ this.descripcion = descripcion;
+ }
- private String descripcion;
+ @XmlTransient
+ public List<Ejercicio> getEjercicioList() {
+ return ejercicioList;
+ }
- public Respuesta() {
- }
+ public void setEjercicioList(List<Ejercicio> ejercicioList) {
+ this.ejercicioList = ejercicioList;
+ }
- public Integer getIdRespuesta() {
- return this.idRespuesta;
- }
+ @XmlTransient
+ public List<Ejercicio> getEjercicioList1() {
+ return ejercicioList1;
+ }
- public void setIdRespuesta(Integer idRespuesta) {
- this.idRespuesta = idRespuesta;
- }
+ public void setEjercicioList1(List<Ejercicio> ejercicioList1) {
+ this.ejercicioList1 = ejercicioList1;
+ }
- public String getDescripcion() {
- return this.descripcion;
- }
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idRespuesta != null ? idRespuesta.hashCode() : 0);
+ return hash;
+ }
- public void setDescripcion(String descripcion) {
- this.descripcion = descripcion;
- }
+ @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 Respuesta)) {
+ return false;
+ }
+ Respuesta other = (Respuesta) object;
+ if ((this.idRespuesta == null && other.idRespuesta != null) || (this.idRespuesta != null && !this.idRespuesta.equals(other.idRespuesta))) {
+ return false;
+ }
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "model.Respuesta[ idRespuesta=" + idRespuesta + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Sesion.java b/EjercitarJPA/src/model/Sesion.java
index 16145df..b7b195f 100644
--- a/EjercitarJPA/src/model/Sesion.java
+++ b/EjercitarJPA/src/model/Sesion.java
@@ -1,52 +1,176 @@
+/*
+ * 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.Date;
+import java.util.List;
+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.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the sesion database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "SESION")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Sesion.findAll", query = "SELECT s FROM Sesion s"),
+ @NamedQuery(name = "Sesion.findByIdSesion", query = "SELECT s FROM Sesion s WHERE s.idSesion = :idSesion"),
+ @NamedQuery(name = "Sesion.findByEntrada", query = "SELECT s FROM Sesion s WHERE s.entrada = :entrada"),
+ @NamedQuery(name = "Sesion.findBySalida", query = "SELECT s FROM Sesion s WHERE s.salida = :salida"),
+ @NamedQuery(name = "Sesion.findByAyudaPadres", query = "SELECT s FROM Sesion s WHERE s.ayudaPadres = :ayudaPadres"),
+ @NamedQuery(name = "Sesion.findByDesdeHogar", query = "SELECT s FROM Sesion s WHERE s.desdeHogar = :desdeHogar"),
+ @NamedQuery(name = "Sesion.findByEstadoAnimo", query = "SELECT s FROM Sesion s WHERE s.estadoAnimo = :estadoAnimo")})
public class Sesion 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_sesion")
+ private Integer idSesion;
+ @Basic(optional = false)
+ @NotNull
+ @Column(name = "entrada")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date entrada;
+ @Basic(optional = false)
+ @NotNull
+ @Column(name = "salida")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date salida;
+ @Column(name = "ayuda_padres")
+ private Boolean ayudaPadres;
+ @Column(name = "desde_hogar")
+ private Boolean desdeHogar;
+ @Size(max = 5)
+ @Column(name = "estado_animo")
+ private String estadoAnimo;
+ @ManyToMany(mappedBy = "sesionList")
+ private List<Alumno> alumnoList;
+ @OneToMany(mappedBy = "idSesion")
+ private List<Tarea> tareaList;
+
+ public Sesion() {
+ }
+
+ public Sesion(Integer idSesion) {
+ this.idSesion = idSesion;
+ }
+
+ public Sesion(Integer idSesion, Date entrada, Date salida) {
+ this.idSesion = idSesion;
+ this.entrada = entrada;
+ this.salida = salida;
+ }
+
+ public Integer getIdSesion() {
+ return idSesion;
+ }
+
+ public void setIdSesion(Integer idSesion) {
+ this.idSesion = idSesion;
+ }
+
+ public Date getEntrada() {
+ return entrada;
+ }
+
+ public void setEntrada(Date entrada) {
+ this.entrada = entrada;
+ }
+
+ public Date getSalida() {
+ return salida;
+ }
+
+ public void setSalida(Date salida) {
+ this.salida = salida;
+ }
+
+ public Boolean getAyudaPadres() {
+ return ayudaPadres;
+ }
+
+ public void setAyudaPadres(Boolean ayudaPadres) {
+ this.ayudaPadres = ayudaPadres;
+ }
- @Id
- @Column(name="\"idSesion\"")
- private Integer idSesion;
+ public Boolean getDesdeHogar() {
+ return desdeHogar;
+ }
- @Column(name="\"idAlumno\"")
- private Integer idAlumno;
+ public void setDesdeHogar(Boolean desdeHogar) {
+ this.desdeHogar = desdeHogar;
+ }
- @Column(name="\"idProfesor\"")
- private Integer idProfesor;
+ public String getEstadoAnimo() {
+ return estadoAnimo;
+ }
- public Sesion() {
- }
+ public void setEstadoAnimo(String estadoAnimo) {
+ this.estadoAnimo = estadoAnimo;
+ }
- public Integer getIdSesion() {
- return this.idSesion;
- }
+ @XmlTransient
+ public List<Alumno> getAlumnoList() {
+ return alumnoList;
+ }
- public void setIdSesion(Integer idSesion) {
- this.idSesion = idSesion;
- }
+ public void setAlumnoList(List<Alumno> alumnoList) {
+ this.alumnoList = alumnoList;
+ }
- public Integer getIdAlumno() {
- return this.idAlumno;
- }
+ @XmlTransient
+ public List<Tarea> getTareaList() {
+ return tareaList;
+ }
- public void setIdAlumno(Integer idAlumno) {
- this.idAlumno = idAlumno;
- }
+ public void setTareaList(List<Tarea> tareaList) {
+ this.tareaList = tareaList;
+ }
- public Integer getIdProfesor() {
- return this.idProfesor;
- }
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idSesion != null ? idSesion.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 Sesion)) {
+ return false;
+ }
+ Sesion other = (Sesion) object;
+ if ((this.idSesion == null && other.idSesion != null) || (this.idSesion != null && !this.idSesion.equals(other.idSesion))) {
+ return false;
+ }
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "model.Sesion[ idSesion=" + idSesion + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Tarea.java b/EjercitarJPA/src/model/Tarea.java
index 73a35a1..c1e1484 100644
--- a/EjercitarJPA/src/model/Tarea.java
+++ b/EjercitarJPA/src/model/Tarea.java
@@ -1,52 +1,125 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
package model;
import java.io.Serializable;
-import javax.persistence.*;
-
+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.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
/**
- * The persistent class for the tarea database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "TAREA")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Tarea.findAll", query = "SELECT t FROM Tarea t"),
+ @NamedQuery(name = "Tarea.findByIdTarea", query = "SELECT t FROM Tarea t WHERE t.idTarea = :idTarea"),
+ @NamedQuery(name = "Tarea.findByDescripcion", query = "SELECT t FROM Tarea t WHERE t.descripcion = :descripcion")})
public class Tarea 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_tarea")
+ private Integer idTarea;
+ @Size(max = 2147483647)
+ @Column(name = "descripcion")
+ private String descripcion;
+ @JoinColumn(name = "id_tema", referencedColumnName = "id_tema")
+ @ManyToOne
+ private Tema tema;
+ @JoinColumn(name = "id_sesion", referencedColumnName = "id_sesion")
+ @ManyToOne
+ private Sesion idSesion;
+ @JoinColumn(name = "id_curso", referencedColumnName = "id_curso")
+ @ManyToOne
+ private Curso curso;
+
+ public Tarea() {
+ }
+
+ public Tarea(Integer idTarea) {
+ this.idTarea = idTarea;
+ }
+
+ public Integer getIdTarea() {
+ return idTarea;
+ }
+
+ public void setIdTarea(Integer idTarea) {
+ this.idTarea = idTarea;
+ }
- @Id
- @Column(name="\"idTarea\"")
- private Integer idTarea;
+ public String getDescripcion() {
+ return descripcion;
+ }
- @Column(name="\"idCurso\"")
- private Integer idCurso;
+ public void setDescripcion(String descripcion) {
+ this.descripcion = descripcion;
+ }
- @Column(name="\"idTema\"")
- private Integer idTema;
+ public Tema getTema() {
+ return tema;
+ }
- public Tarea() {
- }
+ public void setTema(Tema tema) {
+ this.tema = tema;
+ }
- public Integer getIdTarea() {
- return this.idTarea;
- }
+ public Sesion getIdSesion() {
+ return idSesion;
+ }
- public void setIdTarea(Integer idTarea) {
- this.idTarea = idTarea;
- }
+ public void setIdSesion(Sesion idSesion) {
+ this.idSesion = idSesion;
+ }
- public Integer getIdCurso() {
- return this.idCurso;
- }
+ public Curso getCurso() {
+ return curso;
+ }
- public void setIdCurso(Integer idCurso) {
- this.idCurso = idCurso;
- }
+ public void setCurso(Curso curso) {
+ this.curso = curso;
+ }
- public Integer getIdTema() {
- return this.idTema;
- }
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idTarea != null ? idTarea.hashCode() : 0);
+ return hash;
+ }
- public void setIdTema(Integer idTema) {
- this.idTema = idTema;
- }
+ @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 Tarea)) {
+ return false;
+ }
+ Tarea other = (Tarea) object;
+ if ((this.idTarea == null && other.idTarea != null) || (this.idTarea != null && !this.idTarea.equals(other.idTarea))) {
+ return false;
+ }
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "model.Tarea[ idTarea=" + idTarea + " ]";
+ }
+
+}
diff --git a/EjercitarJPA/src/model/Tema.java b/EjercitarJPA/src/model/Tema.java
index e9eef4e..1c6eb36 100644
--- a/EjercitarJPA/src/model/Tema.java
+++ b/EjercitarJPA/src/model/Tema.java
@@ -1,63 +1,137 @@
+/*
+ * 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 java.util.List;
+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.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
/**
- * The persistent class for the tema database table.
- *
+ *
+ * @author Ceci
*/
@Entity
+@Table(name = "TEMA")
+@XmlRootElement
+@NamedQueries({
+ @NamedQuery(name = "Tema.findAll", query = "SELECT t FROM Tema t"),
+ @NamedQuery(name = "Tema.findByIdTema", query = "SELECT t FROM Tema t WHERE t.idTema = :idTema"),
+ @NamedQuery(name = "Tema.findByNombre", query = "SELECT t FROM Tema t WHERE t.nombre = :nombre"),
+ @NamedQuery(name = "Tema.findByDescripcion", query = "SELECT t FROM Tema t WHERE t.descripcion = :descripcion")})
public class Tema implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name="\"idTema\"")
- private Integer idTema;
-
- private String descripcion;
-
- private String nombre;
-
- //bi-directional many-to-one association to Tarea
- @OneToMany(mappedBy="tema")
- private List<Tarea> tareas;
-
- public Tema() {
- }
-
- public Integer getIdTema() {
- return this.idTema;
- }
-
- public void setIdTema(Integer idTema) {
- this.idTema = idTema;
- }
-
- public String getDescripcion() {
- return this.descripcion;
- }
-
- public void setDescripcion(String descripcion) {
- this.descripcion = descripcion;
- }
-
- public String getNombre() {
- return this.nombre;
- }
-
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
-
- public List<Tarea> getTareas() {
- return this.tareas;
- }
-
- public void setTareas(List<Tarea> tareas) {
- this.tareas = tareas;
- }
-
-} \ No newline at end of file
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Basic(optional = false)
+ @Column(name = "id_tema")
+ private Integer idTema;
+ @Basic(optional = false)
+ @NotNull
+ @Size(min = 1, max = 2147483647)
+ @Column(name = "nombre")
+ private String nombre;
+ @Size(max = 2147483647)
+ @Column(name = "descripcion")
+ private String descripcion;
+ @OneToMany(mappedBy = "tema")
+ private List<Tarea> tareaList;
+ @JoinColumn(name = "id_concepto", referencedColumnName = "id_concepto")
+ @ManyToOne
+ private Concepto idConcepto;
+
+ public Tema() {
+ }
+
+ public Tema(Integer idTema) {
+ this.idTema = idTema;
+ }
+
+ public Tema(Integer idTema, String nombre) {
+ this.idTema = idTema;
+ this.nombre = nombre;
+ }
+
+ public Integer getIdTema() {
+ return idTema;
+ }
+
+ public void setIdTema(Integer idTema) {
+ this.idTema = idTema;
+ }
+
+ public String getNombre() {
+ return nombre;
+ }
+
+ public void setNombre(String nombre) {
+ this.nombre = nombre;
+ }
+
+ public String getDescripcion() {
+ return descripcion;
+ }
+
+ public void setDescripcion(String descripcion) {
+ this.descripcion = descripcion;
+ }
+
+ @XmlTransient
+ public List<Tarea> getTareaList() {
+ return tareaList;
+ }
+
+ public void setTareaList(List<Tarea> tareaList) {
+ this.tareaList = tareaList;
+ }
+
+ public Concepto getIdConcepto() {
+ return idConcepto;
+ }
+
+ public void setIdConcepto(Concepto idConcepto) {
+ this.idConcepto = idConcepto;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (idTema != null ? idTema.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 Tema)) {
+ return false;
+ }
+ Tema other = (Tema) object;
+ if ((this.idTema == null && other.idTema != null) || (this.idTema != null && !this.idTema.equals(other.idTema))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "model.Tema[ idTema=" + idTema + " ]";
+ }
+
+}