List of usage examples for org.hibernate Session save
Serializable save(Object object);
From source file:backend.api.StorageManagement.java
public boolean addProduct(Products product) //ok { Session s = sf.openSession(); try {//from w w w.j ava2s . co m Transaction tx = s.beginTransaction(); try { s.save(product); tx.commit(); return true; } catch (Exception e) { tx.rollback(); return false; } } finally { s.close(); } }
From source file:backend.api.StorageManagement.java
public boolean addCategory(Category cat) //ok { Session s = sf.openSession(); try {/*w w w . jav a2 s . co m*/ Transaction tx = s.beginTransaction(); try { s.save(cat); tx.commit(); return true; } catch (Exception e) { tx.rollback(); return false; } } finally { s.close(); } }
From source file:backend.api.StorageManagement.java
public boolean addManufacturer(Manufacturers man) //ok { Session s = sf.openSession(); try {/*from w w w . java 2s. c o m*/ Transaction tx = s.beginTransaction(); try { s.save(man); tx.commit(); return true; } catch (Exception e) { tx.rollback(); return false; } } finally { s.close(); } }
From source file:backend.api.StorageManagement.java
public boolean addAttributes(Attributes at) //ok { Session s = sf.openSession(); try {//from ww w. j ava 2s .c o m Transaction tx = s.beginTransaction(); try { s.save(at); tx.commit(); return true; } catch (Exception e) { tx.rollback(); return false; } } catch (Exception e) { e.printStackTrace(); return false; } finally { s.close(); } }
From source file:backend.api.StorageManagement.java
public boolean addFinanceRegisterRecord(FinanceRegister fr) /// ok { Session s = sf.openSession(); try {// w w w . ja va2 s .co m Transaction tx = s.beginTransaction(); try { s.save(fr); tx.commit(); return true; } catch (Exception e) { e.printStackTrace(); tx.rollback(); return false; } } catch (Exception e) { e.printStackTrace(); return false; } finally { s.close(); } }
From source file:backend.core.controller.ProductsController.java
public void addProduct(Products product) { Session s = getInstance().openSession(); try {/* www .j av a2s . co m*/ Transaction tx = s.beginTransaction(); try { s.save(product); tx.commit(); } catch (Exception e) { tx.rollback(); } } finally { s.close(); } }
From source file:backend.core.controller.ProductsController.java
public void addP() { Session session = getInstance().openSession(); session.beginTransaction();/*from www .j ava2 s .c o m*/ Groups g = new Groups("kasjer", "kaka bukaka saka laka ", 4500); Users u = new Users("test", "test2", "sergerg", "grgeg", new Date(), new Date()); Category c = new Category("d"); session.save(c); Set<Groups> groups = new HashSet<Groups>(); groups.add(g); u.setGroups(groups); Products p = new Products("spudnica", c, 1, 10, 1); session.save(p); Orders o = new Orders(1, new Date(), 1, p, u); session.save(u); session.save(o); session.getTransaction().commit(); }
From source file:backend.core.controller.ProductsController.java
public void monitoring() { Session session = getInstance().openSession(); session.beginTransaction();/* www .jav a2 s . com*/ //Monitoring m = new Monitoring("test", "test", new Date(), "test"); MonitoringWorkers mw = new MonitoringWorkers(new Date(), new Date(), new Date(), new Date(), 8); session.save(mw); //session.save(mw); session.getTransaction().commit(); }
From source file:backend.core.controller.UserController.java
public void addUser(Users user) { Session s = getInstance().openSession(); try {// w ww .ja va2 s.c o m Transaction tx = s.beginTransaction(); try { s.save(user); tx.commit(); } catch (Exception e) { tx.rollback(); } } finally { s.close(); } }
From source file:baking.dao.BaseDao.java
License:Open Source License
/** * ?/* w ww . j a v a2s . com*/ * @description * @author JiaCao * @param obj * @return */ public void save(Object obj) { try { Session session = getSession(); session.save(obj); } catch (RuntimeException re) { throw re; } }