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.EmbarqueCatracaRodoviariaDAO;
import com.rjconsultores.ventaboletos.entidad.EmbarqueCatracaRodoviaria;

@Repository("embarqueCatracaRodoviariaDAO")
public class EmbarqueCatracaRodoviariaHibernateDAO
		extends GenericHibernateDAO<EmbarqueCatracaRodoviaria, Integer> implements EmbarqueCatracaRodoviariaDAO {

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

	@Override
	public List<EmbarqueCatracaRodoviaria> obtenerTodos() {
		Criteria criteria = getSession().createCriteria(getPersistentClass());
		criteria.add(Restrictions.eq(ACTIVO, true));
		return criteria.list();
	}
}
