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.GP_PricingFormapagoDAO;
import com.rjconsultores.ventaboletos.entidad.GP_Pricing;
import com.rjconsultores.ventaboletos.entidad.GP_PricingFormapago;

@Repository("gp_pricingFormapagoDAO")
public class GP_PricingFormapagoHibernateDAO extends GenericHibernateDAO<GP_PricingFormapago, Integer> implements GP_PricingFormapagoDAO {

	@Autowired
	public GP_PricingFormapagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
		setSessionFactory(factory);
	}

	@Override
	public List<GP_PricingFormapago> obtenerTodoPorPricing(GP_Pricing pricing) {
		Criteria c = getSession().createCriteria(getPersistentClass());
		c.add(Restrictions.eq("pricing.pricingId", pricing.getPricingId()));

		return c.list();
	}

}
