List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:br.com.aula.dao.DepartamentoDAO.java
public void alterarDepartamento(Departamento departamento) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.update(departamento);//from w w w . j a v a 2 s . c o m session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.DepartamentoDAO.java
public void removerDepartamento(Departamento departamento) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.delete(departamento);//from w w w . j a v a 2s .co m session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.DependenteDAO.java
public Dependente consultarDependentePorId(int idDependente) { Session session = factory.openSession(); Dependente dependente = (Dependente) session.createQuery("from Dependente where id=" + idDependente).list() .iterator().next();// w ww . java 2 s . c o m session.flush(); session.close(); return dependente; }
From source file:br.com.aula.dao.DependenteDAO.java
public void inserirDependente(Dependente dependente) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.save(dependente);// www.j av a 2 s . co m session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.DependenteDAO.java
public void alterarDependente(Dependente dependente) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.update(dependente);//from ww w.java 2s .co m session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.DependenteDAO.java
public void removerDependente(Dependente dependente) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.delete(dependente);/*from ww w . j av a 2 s.com*/ session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.EmpresaDAO.java
public List<Empresa> listarTodosEmpresas() { Session session = factory.openSession(); List<Empresa> empresas = session.createQuery("from Empresa").list(); session.flush(); session.close();//from w ww .j av a 2 s .com return empresas; }
From source file:br.com.aula.dao.EmpresaDAO.java
public Empresa consultarEmpresaPorId(int idEmpresa) { Session session = factory.openSession(); Empresa empresa = (Empresa) session.createQuery("from Empresa where id=" + idEmpresa).list().iterator() .next();// ww w . j a v a 2s .c om session.flush(); session.close(); return empresa; }
From source file:br.com.aula.dao.EmpresaDAO.java
public void inserirEmpresa(Empresa empresa) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.save(empresa);/*from ww w . j a v a 2s .c o m*/ session.flush(); transaction.commit(); session.close(); }
From source file:br.com.aula.dao.EmpresaDAO.java
public void alterarEmpresa(Empresa empresa) { Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.update(empresa);//from ww w. j a v a2s. com session.flush(); transaction.commit(); session.close(); }