AdmMono/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDA...

39 lines
1.3 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.CompaniaBancariaDAO;
import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria;
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("companiaBancariaDAO")
public class CompaniaBancariaHibernateDAO extends GenericHibernateDAO<CompaniaBancaria, Integer>
implements CompaniaBancariaDAO {
@Autowired
public CompaniaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
public List<CompaniaBancaria> buscar(CompaniaBancaria companiaBancaria) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq(ACTIVO, true));
c.add(Restrictions.eq("cvecompania", companiaBancaria.getCvecompania()));
c.add(Restrictions.eq("cvesucursal", companiaBancaria.getCvesucursal()));
return c.list();
}
}