53 lines
1.6 KiB
Java
53 lines
1.6 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
|
|
|
import com.rjconsultores.ventaboletos.dao.PricingClaseDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
|
import com.rjconsultores.ventaboletos.entidad.Pricing;
|
|
import com.rjconsultores.ventaboletos.entidad.PricingClase;
|
|
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;
|
|
|
|
/**
|
|
*
|
|
* @author Rafius
|
|
*/
|
|
@Repository("pricingClaseDAO")
|
|
public class PricingClaseHibernateDAO extends GenericHibernateDAO<PricingClase, Integer>
|
|
implements PricingClaseDAO {
|
|
|
|
@Autowired
|
|
public PricingClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
|
setSessionFactory(factory);
|
|
}
|
|
|
|
@Override
|
|
public List<PricingClase> obtenerTodos() {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq("activo", Pricing.ATIVO));
|
|
|
|
return c.list();
|
|
}
|
|
|
|
public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio) {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq("activo", Pricing.ATIVO));
|
|
c.add(Restrictions.eq("pricing", pricing));
|
|
c.add(Restrictions.eq("claseServicio", claseServicio));
|
|
|
|
if (c.list().size() > 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|