List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:com.bakeryfactory.cadastros.servidor.TransportadoraGridAction.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 . ja v a 2 s . c om*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); TransportadoraVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (TransportadoraVO) 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.UfGridAction.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 v a2 s .c om*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); UfVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (UfVO) 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.UnidadeProdutoGridAction.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"); UnidadeProdutoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (UnidadeProdutoVO) 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.calendarioproducao.servidor.AgendaCategoriaCompromissoGridAction.java
public Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {//from ww w.ja v a 2s .c om GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); AgendaCategoriaCompromissoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (AgendaCategoriaCompromissoVO) 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.calendarioproducao.servidor.AgendaCompromissoGridAction.java
public Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {/*from w w w . jav a2 s .com*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); AgendaCompromissoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (AgendaCompromissoVO) 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.calendarioproducao.servidor.ProducaoSalaGridAction.java
public Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Session session = null; try {// ww w. j a v a 2 s.c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); ProducaoSalaVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (ProducaoSalaVO) 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.pcp.servidor.PcpInstrucaoGridAction.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 v a 2s .c o m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); PcpInstrucaoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (PcpInstrucaoVO) 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.pcp.servidor.PcpOpCabecalhoGridAction.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. jav a 2s. c om*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); PcpOpCabecalhoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (PcpOpCabecalhoVO) 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.vendas.servidor.NotaFiscalTipoGridAction.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 a v a2 s . co m GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); NotaFiscalTipoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (NotaFiscalTipoVO) 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.vendas.servidor.VendaCondicoesPagamentoGridAction.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 www . java 2 s . c om*/ GridParams pars = (GridParams) inputPar; ArrayList persistentObjects = (ArrayList) pars.getOtherGridParams().get("persistentObjects"); VendaCondicoesPagamentoVO vo = null; session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for (int i = 0; i < persistentObjects.size(); i++) { vo = (VendaCondicoesPagamentoVO) 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) { } } }