Example usage for org.hibernate Session clear

List of usage examples for org.hibernate Session clear

Introduction

In this page you can find the example usage for org.hibernate Session clear.

Prototype

void clear();

Source Link

Document

Completely clear the session.

Usage

From source file:dao.SubAreaDAO.java

public static SubArea obterSubArea(int codigoSubArea) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();//ww  w. ja v  a 2 s  .  co  m
    session.clear();
    SubArea subArea = (SubArea) session.load(SubArea.class, codigoSubArea);

    return subArea;

}

From source file:dao.SubAreaDAO.java

public static void gravar(SubArea subArea) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.save(subArea);/*from  w w w . j a v  a  2 s  .  c  o  m*/
    transaction.commit();

}

From source file:dao.SubAreaDAO.java

public static void editar(SubArea subArea) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.update(subArea);/*from w w  w  .  j a v a  2 s.  c  om*/
    transaction.commit();

}

From source file:dao.SubAreaDAO.java

public static void excluir(SubArea subArea) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.delete(subArea);//from   w  ww  .j av a 2  s .  c  om
    transaction.commit();

}

From source file:dao.TipoBolsaDAO.java

public static List<Tipobolsa> obterTipoBolsas() throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();/*from w  w  w. j  av a2  s . c  o m*/
    session.clear();
    List<Tipobolsa> tipoBolsas = session.createCriteria(Tipobolsa.class).list();

    return tipoBolsas;
}

From source file:dao.TipoBolsaDAO.java

public static List<Tipobolsa> obterTipoBolsaPorNome(String nomeTipoBolsa)
        throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();//from   w  ww . j a v  a  2  s.  com
    session.clear();
    List<Tipobolsa> tipoBolsas = session.createQuery("from tipoBolsa where nome like '%' +nomeTipoBolsa+'%'")
            .list();

    return tipoBolsas;
}

From source file:dao.TipoBolsaDAO.java

public static Tipobolsa obterTipoBolsa(int codigoTipoBolsa) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();/*from  w  w w  . j  ava2 s. co  m*/
    session.clear();
    Tipobolsa tipoBolsa = (Tipobolsa) session.load(Tipobolsa.class, codigoTipoBolsa);

    return tipoBolsa;

}

From source file:dao.TipoBolsaDAO.java

public static void gravar(Tipobolsa tipoBolsa) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.save(tipoBolsa);/*from w  w w  . ja va 2s.c  om*/
    transaction.commit();

}

From source file:dao.TipoBolsaDAO.java

public static void editar(Tipobolsa tipoBolsa) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.update(tipoBolsa);//from  w  w w  . jav a 2  s.co m
    transaction.commit();

}

From source file:dao.TipoBolsaDAO.java

public static void excluir(Tipobolsa tipoBolsa) throws SQLException, ClassNotFoundException {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    Transaction transaction = session.beginTransaction();
    session.clear();
    session.delete(tipoBolsa);//from ww w.  ja va  2 s .  co m
    transaction.commit();

}