List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:com.bacic5i5j.framework.database.HibernateAccess.java
License:Open Source License
@Override public void delete(T entity) { Session session = sessionFactory.currentSession(); session.delete(entity);/* w ww. j a v a2s. c o m*/ session.flush(); sessionFactory.closeSession(); }
From source file:com.bacic5i5j.framework.database.HibernateAccess.java
License:Open Source License
@Override public void update(T entity) { Session session = sessionFactory.currentSession(); session.update(entity);// ww w .j a v a 2 s . c o m session.flush(); sessionFactory.closeSession(); }
From source file:com.bakeryfactory.cadastros.servidor.AlmoxarifadoGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {//w w w.ja v a 2 s . c om GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); AlmoxarifadoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (AlmoxarifadoVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }
From source file:com.bakeryfactory.cadastros.servidor.AtividadeForCliGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {//from ww w . ja v a2s. c om GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); AtividadeForCliVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (AtividadeForCliVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }
From source file:com.bakeryfactory.cadastros.servidor.CargoGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {/*ww w.j a va 2 s . c o m*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); CargoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (CargoVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }
From source file:com.bakeryfactory.cadastros.servidor.CepGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {// w w w.j a v a 2 s . c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); CepVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (CepVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }
From source file:com.bakeryfactory.cadastros.servidor.ClienteGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {// w w w . j a va 2 s .co m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ClienteVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ClienteVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }
From source file:com.bakeryfactory.cadastros.servidor.ColaboradorGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {// w ww .java 2 s . com GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ColaboradorVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ColaboradorVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception e) { } } }
From source file:com.bakeryfactory.cadastros.servidor.EstadoCivilGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {// w w w . j a v a 2 s . c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); EstadoCivilVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (EstadoCivilVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception e) { } } }
From source file:com.bakeryfactory.cadastros.servidor.FichaTecnicaGridAction.java
License:Open Source License
private Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {//w ww. j a va 2s .c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); FichaTecnicaVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (FichaTecnicaVO) persistentObjects.get(i); session.delete(vo); session.flush(); } session.getTransaction().commit(); return new VOListResponse(persistentObjects, false, persistentObjects.size()); } catch (Exception ex) { if (session != null) { session.getTransaction().rollback(); } ex.printStackTrace(); return new ErrorResponse(ex.getMessage()); } finally { try { if (session != null) { session.close(); } } catch (Exception ex1) { } } }