Package DAO

Source Code of DAO.ClassificacaoRmpDao

package DAO;

import Entidade.ClassificacaoRmp;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
*
* @author Kleysson
*/
public class ClassificacaoRmpDao {
   
   
    public List<ClassificacaoRmp> buscarClassificacoes(){
       
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        List lista = session.createQuery("FROM ClassificacaoRmp").list();
        session.getTransaction().commit();
        session.close();
        return lista;
       
    }
   
    public ClassificacaoRmp consultarPorId(Integer codigo) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Query lista = session.createQuery("FROM ClassificacaoRmp WHERE clasCodigo = :codigo");
        lista.setInteger("codigo", codigo);
        ClassificacaoRmp resultado = (ClassificacaoRmp) lista.uniqueResult();
        session.getTransaction().commit();
        session.close();
        return resultado;
    }
           
   
}
TOP

Related Classes of DAO.ClassificacaoRmpDao

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.