leonardo 2016-08-03 21:15:07 +00:00
parent c36814600f
commit 09aa056bc7
4 changed files with 27 additions and 4 deletions

View File

@ -146,6 +146,9 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
"where ruta_id = " + pvo.rutaId +
" and origen_id = " + pvo.origenId + " and " +
"destino_id = " + pvo.destinoId + ")");
batchExcepcionPeajeVigenciaSql.add("update EXCEPCION_PEAJE set activo = 0 where ruta_id = " + pvo.rutaId +
" and origen_id = " + pvo.origenId + " and " +
"destino_id = " + pvo.destinoId + "");
peajes.add(pvo);
}
}
@ -196,7 +199,7 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
private ExcepcionPeaje getExcepcion(Integer rutaId, Integer origenId, Integer destinoId){
Query query = getSession().createQuery("select e from ExcepcionPeaje e where e.ruta.rutaId = :rutaId "+
"and e.origem.paradaId = :origenId and e.destino.paradaId = :destinoId ");
"and e.origem.paradaId = :origenId and e.destino.paradaId = :destinoId and e.activo = 1 ");
query.setInteger("rutaId", rutaId);
query.setInteger("origenId", origenId);

View File

@ -33,7 +33,7 @@ public class CasetaPeajeExcepcionHibernateDAO extends GenericHibernateDAO<Caseta
public List<CasetaPeajeExcepcion> obtenerPorCasetaPeaje(CasetaPeaje caseta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("casetaPeaje", caseta));
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("activo", true)).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
return c.list();
}

View File

@ -51,8 +51,8 @@ public class CasetaPeaje implements Serializable, Comparable<CasetaPeaje>, Clone
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@OneToMany(mappedBy = "casetaPeaje", fetch=FetchType.LAZY, cascade = CascadeType.ALL)
//@Fetch(FetchMode.SELECT)
@OneToMany(mappedBy = "casetaPeaje")
@Where(clause="ACTIVO=1")
private List<CasetaPeajeExcepcion> lsCasetaPeajeExcepcion = new ArrayList<CasetaPeajeExcepcion>();
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") },

View File

@ -180,4 +180,24 @@ private static final long serialVersionUID = 1L;
return -1;
}
}
@Override
public int hashCode() {
int hash = 0;
hash += casetaPeajeExcepcionId != null ? casetaPeajeExcepcionId.hashCode() : 0;
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof CasetaPeajeExcepcion)) {
return false;
}
CasetaPeajeExcepcion other = (CasetaPeajeExcepcion) object;
if ((this.casetaPeajeExcepcionId == null && other.casetaPeajeExcepcionId != null) || (this.casetaPeajeExcepcionId != null && !this.casetaPeajeExcepcionId.equals(other.casetaPeajeExcepcionId))) {
return false;
}
return true;
}
}