List of usage examples for org.hibernate Session clear
void clear();
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByIDCustomer(int id, String status) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {//from w w w . j av a 2s . c o m session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery( "from PurchaseOrder where ID_Customer like '" + id + "' AND Status like '" + status + "'") .list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByIDWarehouse(int id) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/*from ww w . ja va2 s . c om*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery("from PurchaseOrder where ID_Warehouse like '" + id + "'").list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByIDWarehouse(int id_wh, String dateFrom, String dateTo, String status) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {// ww w .j av a 2 s. co m session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session .createQuery("from PurchaseOrder where ID_Warehouse like '" + id_wh + "' AND Status like '" + status + "' AND Date_Order >='" + dateFrom + "' AND Date_Order <='" + dateTo + "'") .list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByIDWarehouse(int id_wh, String status) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {//from w ww . j av a2s . co m session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery( "from PurchaseOrder where ID_Warehouse like '" + id_wh + "' AND Status like '" + status + "'") .list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByIDWarehouse(int id_wh, String dateFrom, String dateTo) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/* w w w.j ava2s . c om*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery("from PurchaseOrder where ID_Warehouse like '" + id_wh + "' AND Date_Order >='" + dateFrom + "' AND Date_Order <='" + dateTo + "'").list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByAdmin(int pageNumber) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/*from w w w .j a va2 s . c om*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery("from PurchaseOrder").setFirstResult((pageNumber - 1) * pageSize) .setMaxResults(pageSize).list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByAdmin(String dateFrom, String dateTo, String status, String warehouse, int pageNumber) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/*ww w. j ava2 s . c o m*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session .createQuery("from PurchaseOrder where ID_Warehouse like '" + warehouse + "' AND Status like '" + status + "' AND Date_Order >='" + dateFrom + "' AND Date_Order <='" + dateTo + "'") .setFirstResult((pageNumber - 1) * pageSize).setMaxResults(pageSize).list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByAdmin(String status, int pageNumber) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/* w w w . j ava2s. com*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session.createQuery("from PurchaseOrder where Status like '" + status + "'") .setFirstResult((pageNumber - 1) * pageSize).setMaxResults(pageSize).list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByAdmin(String dateFrom, String dateTo, String warehouse, int pageNumber) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {// w w w. j ava2s . com session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session .createQuery("from PurchaseOrder where ID_Warehouse like '" + warehouse + "' AND Date_Order >='" + dateFrom + "' AND Date_Order <='" + dateTo + "'") .setFirstResult((pageNumber - 1) * pageSize).setMaxResults(pageSize).list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }
From source file:autoancillarieslimited.hiberate.dao.PurchaseOrderDAO.java
public List<PurchaseOrder> getListByAdmin(String dateFrom, String dateTo, int pageNumber) { List<PurchaseOrder> set = null; Session session = null; Transaction beginTransaction = null; try {/*from w ww.j a v a 2 s .co m*/ session = HibernateUtil.getSessionFactory().openSession(); beginTransaction = session.beginTransaction(); set = session .createQuery("from PurchaseOrder where Date_Order >='" + dateFrom + "' AND Date_Order <='" + dateTo + "'") .setFirstResult((pageNumber - 1) * pageSize).setMaxResults(pageSize).list(); session.flush(); session.clear(); session.getTransaction().commit(); } catch (HibernateException ex) { ex.printStackTrace(); if (beginTransaction != null) { beginTransaction.rollback(); } } finally { if (session != null) { session.close(); } } return set; }