51 lines
1.7 KiB
Java
51 lines
1.7 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.BancoDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.Banco;
|
|
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("bancoDAO")
|
|
public class BancoHibernateDAO extends GenericHibernateDAO<Banco, Integer>
|
|
implements BancoDAO {
|
|
|
|
@Autowired
|
|
public BancoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
|
setSessionFactory(factory);
|
|
}
|
|
|
|
@Override
|
|
public List<Banco> obtenerTodos() {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
|
|
|
|
return c.list();
|
|
}
|
|
|
|
@Override
|
|
public List<Banco> buscar(Banco banco) {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
|
|
c.add(Restrictions.eq("puntoVenta", banco.getPuntoVenta()));
|
|
c.add(Restrictions.eq("empresa", banco.getEmpresa()));
|
|
c.add(Restrictions.eq("moneda", banco.getMoneda()));
|
|
c.add(Restrictions.eq("nombbanco", banco.getNombbanco().trim()));
|
|
c.add(Restrictions.eq("refcontrato", banco.getRefcontrato().trim()));
|
|
c.add(Restrictions.eq("numcuenta", banco.getNumcuenta()));
|
|
return c.list();
|
|
}
|
|
}
|