List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:com.bakeryfactory.cadastros.servidor.ProdutoMarcaGridAction.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 va2 s .co m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ProdutoMarcaVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ProdutoMarcaVO) 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.ProdutoSubGrupoGridAction.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 w ww. j av a 2 s .c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ProdutoSubGrupoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ProdutoSubGrupoVO) 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.ReceitaGridAction.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 2s. c om GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ReceitaVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ReceitaVO) 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.SetorGridAction.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 . j a v a 2s .c o m*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); SetorVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (SetorVO) 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.SindicatoGridAction.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 w w w .j a v a2 s .c o m*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); SindicatoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (SindicatoVO) 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.SituacaoColaboradorGridAction.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 .j a v a2 s . c o m*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); SituacaoColaboradorVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (SituacaoColaboradorVO) 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.SituacaoForCliGridAction.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. ja va 2 s . com GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); SituacaoForCliVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (SituacaoForCliVO) 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.TipoAdmissaoGridAction.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 o m*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); TipoAdmissaoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (TipoAdmissaoVO) 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.TipoColaboradorGridAction.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 .ja v a 2 s .co m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); TipoColaboradorVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (TipoColaboradorVO) 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.TipoRelacionamentoGridAction.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 w w w . jav a 2 s.c om*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); TipoRelacionamentoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (TipoRelacionamentoVO) 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) { } } }