List of usage examples for org.hibernate Session delete
void delete(Object object);
From source file:cimitero.rest.ReminderRESTService.java
@DELETE @Path("{id}") public ResponseDto removeReminder(@PathParam("id") Integer id) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction();/* ww w . ja v a 2 s .c om*/ TReminder result = (TReminder) session.get(TReminder.class, id); session.delete(result); ResponseDto response = new ResponseDto(true); session.getTransaction().commit(); return response; }
From source file:cimitero.rest.TombRequestRESTService.java
@DELETE @Path("{id}") public ResponseDto removeTombRequest(@PathParam("id") Integer id) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction();//from ww w . j a v a 2s . c o m TTombRequest result = (TTombRequest) session.get(TTombRequest.class, id); session.delete(result); ResponseDto response = new ResponseDto(true); session.getTransaction().commit(); return response; }
From source file:cimitero.rest.TombRESTService.java
@DELETE @Path("{id}") public ResponseDto removeTomb(@PathParam("id") Integer id) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction();//ww w. j a va2 s .co m TTomb result = (TTomb) session.get(TTomb.class, id); session.delete(result); ResponseDto response = new ResponseDto(true); session.getTransaction().commit(); return response; }
From source file:cit360.hibernate.hibernateDemo.java
private static void deleteSoda(Integer SodaId) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = null;//from ww w . ja v a2 s .c om Soda soda = getSoda(SodaId); try { tx = session.beginTransaction(); session.delete(soda); tx.commit(); } catch (HibernateException e) { if (tx != null) tx.rollback(); e.printStackTrace(); } finally { session.close(); } }
From source file:cl.cesfam.DAO.CaducarDAO.java
public static boolean delete(cl.cesfam.ENTITY.Caducar a) throws Exception { Session session = cl.cesfam.DAL.NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction();//from ww w .j a v a 2s . c o m try { session.delete(a); session.getTransaction().commit(); session.close(); return true; } catch (Exception e) { session.getTransaction().rollback(); session.close(); System.err.println(e.getMessage()); throw e; } }
From source file:cl.cesfam.DAO.ComponenteDAO.java
public static boolean delete(cl.cesfam.ENTITY.Componente a) throws Exception { Session session = cl.cesfam.DAL.NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*from w ww . j av a2s.c o m*/ try { session.delete(a); session.getTransaction().commit(); session.close(); return true; } catch (Exception e) { session.getTransaction().rollback(); session.close(); System.err.println(e.getMessage()); throw e; } }