Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashSet;
- import java.util.Set;
- import javax.persistence.CascadeType;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.FetchType;
- import javax.persistence.GeneratedValue;
- import static javax.persistence.GenerationType.IDENTITY;
- import javax.persistence.Id;
- import javax.persistence.OneToMany;
- import javax.persistence.Table;
- import javax.persistence.UniqueConstraint;
- @Entity
- @Table(name = "escuela", catalog = "matriculadelaboratorio", uniqueConstraints =
- @UniqueConstraint(columnNames = "codigo"))
- public class Escuela implements java.io.Serializable {
- private Integer idEscuela;
- private String codigo;
- private String nombre;
- private boolean estado;
- private Set<Curso> cursos = new HashSet<Curso>(0);
- public Escuela() {
- }
- public Escuela(String codigo, String nombre, boolean estado) {
- this.codigo = codigo;
- this.nombre = nombre;
- this.estado = estado;
- }
- public Escuela(String codigo, String nombre, boolean estado, Set<Curso> cursos) {
- this.codigo = codigo;
- this.nombre = nombre;
- this.estado = estado;
- this.cursos = cursos;
- }
- @Id
- @GeneratedValue(strategy = IDENTITY)
- @Column(name = "idEscuela", unique = true, nullable = false)
- public Integer getIdEscuela() {
- return this.idEscuela;
- }
- public void setIdEscuela(Integer idEscuela) {
- this.idEscuela = idEscuela;
- }
- @Column(name = "codigo", unique = true, nullable = false, length = 2)
- public String getCodigo() {
- return this.codigo;
- }
- public void setCodigo(String codigo) {
- this.codigo = codigo;
- }
- @Column(name = "nombre", nullable = false, length = 45)
- public String getNombre() {
- return this.nombre;
- }
- public void setNombre(String nombre) {
- this.nombre = nombre;
- }
- @Column(name = "estado", nullable = false)
- public boolean isEstado() {
- return this.estado;
- }
- public void setEstado(boolean estado) {
- this.estado = estado;
- }
- @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "escuela")
- public Set<Curso> getCursos() {
- return this.cursos;
- }
- public void setCursos(Set<Curso> cursos) {
- this.cursos = cursos;
- }
- @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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement