leonardo 2016-08-04 18:49:49 +00:00
parent 7ccc6ad523
commit 1b8e707921
2 changed files with 15 additions and 14 deletions

View File

@ -220,20 +220,19 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
Map<Integer, CasetaPeaje> casetas = buscaCasetas(pvos);
Map<Integer, ExcepcionPeaje> excepciones = new HashMap<Integer, ExcepcionPeaje>();
for (PeajeVO peaje : pvos){
ExcepcionPeaje excepcion = getExcepcion(peaje.rutaId, peaje.origenId, peaje.destinoId);
if (excepcion == null){
excepcion = new ExcepcionPeaje();
excepcion.setActivo(true);
excepcion.setDestino(getParada(peaje.destinoId));
excepcion.setFecmodif(Calendar.getInstance().getTime());
excepcion.setOrigem(getParada(peaje.origenId));
excepcion.setRuta(getRuta(peaje.rutaId));
excepcion.setUsuarioId(1);
}
ExcepcionPeaje excepcion = null;
CasetaPeaje caseta = casetas.get(peaje.casetaPeajeId);
for (CasetaPeajeExcepcion cpe : caseta.getLsCasetaPeajeExcepcion()){
if (excepcion == null){
excepcion = new ExcepcionPeaje();
excepcion.setActivo(true);
excepcion.setDestino(getParada(peaje.destinoId));
excepcion.setFecmodif(Calendar.getInstance().getTime());
excepcion.setOrigem(getParada(peaje.origenId));
excepcion.setRuta(getRuta(peaje.rutaId));
excepcion.setUsuarioId(1);
}
ExcepcionPeajeVigencia epv = new ExcepcionPeajeVigencia();
epv.setActivo(cpe.getActivo());
epv.setExcepcionPeaje(excepcion);
@ -253,9 +252,10 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
epv.setUsuarioId(1);
epv.setCasetaPeaje(caseta);
excepcion.getLsExcepcionPeajeVigencia().add(epv);
}
if (excepcion != null){
getSession().saveOrUpdate(excepcion);
}
getSession().saveOrUpdate(excepcion);
}
}

View File

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