Ejemplo n.º 1
0
 public boolean updateOrder(OrderBean order) {
   session = HibernateUtil.getSessionFactory().openSession();
   try {
     transaction = session.beginTransaction();
     session.update(order);
     transaction.commit();
   } catch (Exception e) {
     transaction.rollback();
   } finally {
     session.close();
   }
   return true;
 }
Ejemplo n.º 2
0
 public List<OrderBean> getAllOrder() {
   session = HibernateUtil.getSessionFactory().openSession();
   try {
     String sql = "FROM OrderBean";
     Query query = session.createQuery(sql);
     listOrder = query.list();
   } catch (HandlerException e) {
     e.printStackTrace();
   } finally {
     session.close();
   }
   return listOrder;
 }
Ejemplo n.º 3
0
 public boolean addOrder(OrderBean order) {
   session = HibernateUtil.getSessionFactory().openSession();
   try {
     transaction = session.beginTransaction();
     session.save(order);
     transaction.commit();
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   } finally {
     session.close();
   }
   return true;
 }