43 lines
1.4 KiB
Java
43 lines
1.4 KiB
Java
package com.rjconsultores.ventaboletos.dao.hibernate;
|
|
|
|
import java.util.List;
|
|
|
|
import org.hibernate.Criteria;
|
|
import org.hibernate.SessionFactory;
|
|
import org.hibernate.criterion.Restrictions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import com.rjconsultores.ventaboletos.dao.TarifaKmDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
|
import com.rjconsultores.ventaboletos.entidad.TarifaKm;
|
|
|
|
/**
|
|
*
|
|
* @author daniel.zauli
|
|
*/
|
|
@Repository("tarifaKmDAO")
|
|
public class TarifaKmHibernateDAO extends GenericHibernateDAO<TarifaKm, Integer>
|
|
implements TarifaKmDAO {
|
|
|
|
@Autowired
|
|
public TarifaKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
|
setSessionFactory(factory);
|
|
}
|
|
|
|
public List<TarifaKm> buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId));
|
|
if( claseId.getClaseservicioId() != -1){
|
|
c.add(Restrictions.eq("claseServicio", claseId));
|
|
}
|
|
|
|
|
|
return c.list();
|
|
}
|
|
|
|
}
|