julio 2015-08-17 13:34:59 +00:00
parent cff06cca36
commit 211ebda930
5 changed files with 84 additions and 33 deletions

View File

@ -26,7 +26,7 @@ public class CursoHibernateDAO extends GenericHibernateDAO<Curso, Integer>
public List<Curso> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("nomCurso"));
c.addOrder(Order.asc("nomcurso"));
return c.list();
}

View File

@ -27,7 +27,7 @@ public class EscolaHibernateDAO extends GenericHibernateDAO<Escola, Integer>
public List<Escola> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("nombEscola"));
c.addOrder(Order.asc("nombescola"));
return c.list();
}

View File

@ -16,6 +16,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
@ -116,6 +117,12 @@ public class Cliente implements Serializable {
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
private List<ClienteDescuento> lsClienteDescuento;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "CURSO_ID", referencedColumnName = "CURSO_ID")
private Curso curso;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "ESCOLA_ID", referencedColumnName = "ESCOLA_ID")
private Escola escola;
public Cliente() {
}
@ -388,30 +395,6 @@ public class Cliente implements Serializable {
this.indBloqueo = indBloqueo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (clienteId != null ? clienteId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.clienteId == null && other.clienteId != null) || (this.clienteId != null && !this.clienteId.equals(other.clienteId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.rjconsultores.ventaboletos.entidad.Cliente[ clienteId=" + clienteId + " ]";
}
public TipoIdentificacion getTipoIdentificacionUno() {
return tipoIdentificacionUno;
}
@ -436,4 +419,43 @@ public class Cliente implements Serializable {
this.lsClienteDescuento = lsClienteDescuento;
}
public Curso getCurso() {
return curso;
}
public void setCurso(Curso curso) {
this.curso = curso;
}
public Escola getEscola() {
return escola;
}
public void setEscola(Escola escola) {
this.escola = escola;
}
@Override
public int hashCode() {
int hash = 0;
hash += (clienteId != null ? clienteId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.clienteId == null && other.clienteId != null) || (this.clienteId != null && !this.clienteId.equals(other.clienteId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.rjconsultores.ventaboletos.entidad.Cliente[ clienteId=" + clienteId + " ]";
}
}

View File

@ -38,31 +38,46 @@ public class Curso implements Serializable {
public Integer getCursoId() {
return cursoId;
}
public void setCursoId(Integer cursoId) {
this.cursoId = cursoId;
}
public String getNomcurso() {
return nomcurso;
}
public void setNomcurso(String nomcurso) {
this.nomcurso = nomcurso;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
@Override
public String toString() {
return this.nomcurso;
}
}

View File

@ -1,9 +1,7 @@
package com.rjconsultores.ventaboletos.entidad;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
@ -13,7 +11,6 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
@ -46,37 +43,54 @@ public class Escola implements Serializable {
public Integer getEscolaId() {
return escolaId;
}
public void setEscolaId(Integer escolaId) {
this.escolaId = escolaId;
}
public String getNombescola() {
return nombescola;
}
public void setNombescola(String nombescola) {
this.nombescola = nombescola;
}
public Ciudad getCiudad() {
return ciudad;
}
public void setCiudad(Ciudad ciudad) {
this.ciudad = ciudad;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
@Override
public String toString() {
return this.nombescola;
}
}