List of usage examples for org.hibernate Session persist
void persist(Object object);
From source file:Dao.TicketTypePriceDAO.java
public void addTicketTypePrice(TicketTypePrice u) { Session session = this.sessionFactory.getCurrentSession(); session.persist(u); logger.info("TicketTypePrice saved successfully, TicketTypePrice Details=" + u); }
From source file:dao.TituloDao.java
public void cadastra(Titulo titulo) { System.out.println("TESTE dao"); Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = null;//w w w .j a v a2 s . c o m try { t = session.beginTransaction(); session.persist(titulo); t.commit(); } catch (Exception e) { if (t != null) t.rollback(); throw e; } finally { session.close(); } }
From source file:Dao.UtilisateurDAOImpl.java
@Override public void persist(Utilisateur user) { Session session = factory.openSession(); session.beginTransaction();/* ww w. j a v a2 s. c o m*/ for (int i = 0; i < user.getPermissions().size(); i++) { user.getPermissions().set(i, permissionDao.getById(user.getPermissions().get(i).getId())); } session.persist(user); session.getTransaction().commit(); session.close(); }
From source file:dao.VentaDaoImpl.java
@Override public boolean create(Venta venta) { boolean flag; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try {/*from w ww . j a v a2 s.co m*/ session.beginTransaction(); session.persist(venta); session.getTransaction().commit(); flag = true; } catch (Exception e) { flag = false; throw e; } return flag; }
From source file:daoImpl.GroupsDAOImpl.java
@Override public void addGroup(Groups g) { Session session = sFac.openSession(); Transaction tx = session.beginTransaction(); session.persist(g); tx.commit();/*from w w w . j av a 2 s . c om*/ session.close(); }
From source file:daoImpl.GroupsDAOImpl.java
@Override public void addMember(UsersGroups ug) { Session session = sFac.openSession(); Transaction tx = session.beginTransaction(); session.persist(ug); tx.commit();/*from w ww. ja v a 2s . co m*/ session.close(); }
From source file:daoImpl.GroupsDAOImpl.java
@Override public Tags addNewTag(Tags tag) { Session session = sFac.openSession(); Transaction tx = session.beginTransaction(); session.persist(tag); tx.commit();//w w w .j a v a2 s. com session.close(); Tags results = findTagByName(tag.getTagName()); return results; }
From source file:daos.AppAdminDaos.java
static public boolean insertAppAdmin(Appadmin admin) { Session session = ConnectionFactory.getAppAdminSession(); session.beginTransaction();/*w w w . ja va 2s .c o m*/ session.persist(admin); session.getTransaction().commit(); session.close(); return true; }
From source file:daos.AppUserDaos.java
static public boolean insertAppUser(Appuser user) { Session session = ConnectionFactory.getAppUserSession(); session.beginTransaction();//from ww w .ja v a 2 s . com session.persist(user); session.getTransaction().commit(); session.close(); return true; }
From source file:daos.BookDaos.java
static public boolean insertBook(Books book) { Session session = ConnectionFactory.getBookSession(); session.beginTransaction();//from w w w . j a va 2 s .c om session.persist(book); session.getTransaction().commit(); session.close(); return true; }