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

46 lines
1.5 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.PtoVtaUsuarioBancarioDAO;
import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
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 Desenvolvimento
*/
@Repository("ptoVtaUsuarioBancarioDAO")
public class PtoVtaUsuarioBancarioHibernateDAO extends GenericHibernateDAO<PtoVtaUsuarioBancario, Integer>
implements PtoVtaUsuarioBancarioDAO {
@Autowired
public PtoVtaUsuarioBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<PtoVtaUsuarioBancario> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
public void borrarFisico(PtoVtaUsuarioBancario pto2) {
String hql = " delete from PtoVtaUsuarioBancario "
+ " where ptovtaUsuarioBancarioID = " + pto2.getPtovtaUsuarioBancarioID();
Query sq = getSession().createQuery(hql);
sq.executeUpdate();
}
}