Package hsv.DAO

Source Code of hsv.DAO.RepasseDAO

package hsv.DAO;

import hsv.beans.RepasseRadiologia;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

public class RepasseDAO {
    public void salvarDados(RepasseRadiologia repasse) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.save(repasse);
        session.getTransaction().commit();
        session.close();
    }

    public void editar(RepasseRadiologia repasse) {
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.update(repasse);
        session.getTransaction().commit();
        session.close();
        //return resultado;
    }
   
     public RepasseRadiologia consultar(RepasseRadiologia repasse){  
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Query select = session.createQuery("FROM RepasseRadiologia WHERE dataVigencia = :data AND codigoPrestador = :prestador");
        select.setDate("data", repasse.getDataVigencia());
        select.setInteger("prestador", repasse.getCodigoPrestador());
        RepasseRadiologia resultado = (RepasseRadiologia) select.uniqueResult();
        session.getTransaction().commit();     
        session.close();
        return resultado;       
    }
}
TOP

Related Classes of hsv.DAO.RepasseDAO

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.