Package hsv.DAO

Source Code of hsv.DAO.PagamentoDAO

package hsv.DAO;

import hsv.beans.PagamentoUnimed;
import hsv.beans.RepasseRadiologia;
import org.hibernate.Query;
import org.hibernate.Session;

public class PagamentoDAO {
   
    public void salvarDados(PagamentoUnimed pagamento) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.save(pagamento);
        session.getTransaction().commit();
    }
   
   
    public void editar(PagamentoUnimed pagamento) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.update(pagamento);
        session.getTransaction().commit();
        session.close();
        //return resultado;
    }
   
     public PagamentoUnimed consultar(PagamentoUnimed pagamento){  
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Query select = session.createQuery("FROM PagamentoUnimed WHERE dataVigencia = :data");
        select.setDate("data", pagamento.getDataVigencia());
        PagamentoUnimed resultado = (PagamentoUnimed) select.uniqueResult();
        session.getTransaction().commit();     
        session.close();
        return resultado;       
    }
}
TOP

Related Classes of hsv.DAO.PagamentoDAO

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.