Package hsv.DAO

Source Code of hsv.DAO.RepasseBancoDAO

package hsv.DAO;

import org.hibernate.Session;
import hsv.beans.RepasseBanco;
import org.hibernate.Query;

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

Related Classes of hsv.DAO.RepasseBancoDAO

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.