List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public List<TbInCiiu> listDivision(String idSeccion) throws Exception { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*from ww w. jav a2 s. c o m*/ session.flush(); Query query = session .createQuery("SELECT e FROM TbInCiiu e WHERE e.idSeccion=:_txtBusca GROUP BY e.idDivision") .setParameter("_txtBusca", idSeccion); List<TbInCiiu> entities = query.list(); session.getTransaction().commit(); session.close(); return entities; }
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public List<TbInCiiu> listGrupo(String idDivision) throws Exception { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();// w ww .java2s. c om session.flush(); Query query = session .createQuery("SELECT e FROM TbInCiiu e WHERE e.idDivision=:_txtBusca GROUP BY e.idGrupo") .setParameter("_txtBusca", idDivision); List<TbInCiiu> entities = query.list(); session.getTransaction().commit(); session.close(); return entities; }
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public List<TbInCiiu> listClasebySeccion(String idSeccion) throws Exception { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*from w w w . j a v a 2 s . c o m*/ session.flush(); Query query = session.createQuery("SELECT e FROM TbInCiiu e WHERE e.idSeccion=:_txtBusca") .setParameter("_txtBusca", idSeccion); List<TbInCiiu> entities = query.list(); session.getTransaction().commit(); session.close(); return entities; }
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public List<TbInCiiu> listClasebyDivision(String idDivision) throws Exception { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();//from w ww.j av a2 s . c o m session.flush(); Query query = session.createQuery("SELECT e FROM TbInCiiu e WHERE e.idDivision=:_txtBusca") .setParameter("_txtBusca", idDivision); List<TbInCiiu> entities = query.list(); session.getTransaction().commit(); session.close(); return entities; }
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public List<TbInCiiu> listClasebyGroup(String idGrupo) throws Exception { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*from w w w .ja v a 2 s . c o m*/ session.flush(); Query query = session.createQuery("SELECT e FROM TbInCiiu e WHERE e.idGrupo=:_txtBusca") .setParameter("_txtBusca", idGrupo); List<TbInCiiu> entities = query.list(); session.getTransaction().commit(); session.close(); return entities; }
From source file:bo.gaceta.rcb.dao.impl.TbInCiiuImpl.java
public String desClase(String idClase) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*w w w . j a v a 2s .co m*/ session.flush(); Query query = session.createQuery("SELECT e FROM TbInCiiu e WHERE e.idClase=:_txtBusca") .setParameter("_txtBusca", idClase); TbInCiiu entities = (TbInCiiu) query.uniqueResult(); session.getTransaction().commit(); session.close(); return entities.getClase(); }
From source file:bola.dao.UserDao.java
public void addUser(RegistrationForm regform) { Transaction trns = null;/*from w w w . jav a 2 s . c om*/ Session session = HibernateUtil.getSessionFactory().openSession(); try { trns = session.beginTransaction(); session.save(regform); session.getTransaction().commit(); } catch (RuntimeException e) { if (trns != null) { trns.rollback(); } } finally { session.flush(); session.close(); } }
From source file:br.com.aula.dao.DepartamentoDAO.java
public List<Departamento> listarTodosDepartamentos() { Session session = factory.openSession(); List<Departamento> departamentos = session.createQuery("from Departamento").list(); session.flush(); session.close();// w w w. ja va2 s . c o m return departamentos; }
From source file:br.com.aula.dao.DepartamentoDAO.java
public Departamento consultarDepartamentoPorId(int idDepartamento) { Session session = factory.openSession(); Departamento departamento = (Departamento) session .createQuery("from Departamento where id=" + idDepartamento).list().iterator().next(); session.flush(); session.close();/* w ww. j a v a 2 s .c om*/ return departamento; }
From source file:br.com.aula.dao.DepartamentoDAO.java
public void inserirDepartamento(Departamento departamento) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.save(departamento);/*w w w .jav a2s .c o m*/ session.flush(); transaction.commit(); session.close(); }