List of usage examples for org.hibernate Session update
void update(Object object);
From source file:automatedbillingsoftware_DA.Products_DA.java
public void deleteProducts(int id) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); Query query = session.createQuery("from Products p where p.status=:status AND p.prodid=:id"); query.setParameter("status", 1); query.setParameter("id", id); List<Products> list = (List<Products>) query.list(); Products get = list.get(0);//from w w w. j av a 2 s . com get.setStatus(0); session.update(get); beginTransaction.commit(); }
From source file:automatedbillingsoftware_DA.Products_DA.java
public void updateProduct(Products prod) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); session.update(prod); beginTransaction.commit();/*from w w w. j a va2 s . c o m*/ }
From source file:automatedbillingsoftware_DA.TaxDA.java
public void deleteTax(int id) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); Tax tax = (Tax) session.load(Tax.class, id); tax.setStatus(0);//from w ww .j a v a 2 s. c om session.update(tax); beginTransaction.commit(); }
From source file:automatedbillingsoftware_DA.TaxDA.java
public void updateTax(Tax tax) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); session.update(tax); beginTransaction.commit();/*w ww . j a v a 2 s .c om*/ }
From source file:automatedbillingsoftware_DA.User_DA.java
public void deleteUser(int id) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); Users userId = fetchUserById(id);//w ww . j a v a 2 s .co m userId.setStatus(0); session.update(userId); session.flush(); // session.saveOrUpdate(users); beginTransaction.commit(); // return users; }
From source file:automatedbillingsoftware_DA.User_DA.java
public void updateUser(Users user) { SessionFactory sessionFactory = HibernateUtils.getLocSessionFactory(); Session session = sessionFactory.getCurrentSession(); Transaction beginTransaction = session.beginTransaction(); session.update(user); session.flush();/* w w w . j a v a 2 s. c o m*/ // session.saveOrUpdate(users); beginTransaction.commit(); // return users; }
From source file:ayarlar.yeniAyarlar.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {/* ww w. j a va 2 s . c o m*/ if (jTextField4.getText().equals("") || jTextField5.getText().equals("")) { JOptionPane.showMessageDialog(rootPane, "Ltfen ifre Giriniz "); } else { String ysifre = jTextField4.getText(); String ytsifre = jTextField5.getText(); if (ysifre.equals(ytsifre)) { SessionFactory sf = NewHibernateUtil.getSessionFactory(); Session sesi = sf.openSession(); Transaction tr = sesi.beginTransaction(); Admin ad = new Admin(admin_id); ad.setAdminAdi(jTextField6.getText()); ad.setAdminSoyadi(jTextField7.getText()); ad.setAdminMail(jTextField1.getText()); ad.setAdminTelefon(jTextField2.getText()); ad.setAdminKadi(jTextField3.getText()); String ssifre = MD5(jTextField4.getText()); ad.setAdminSifre(ssifre); Date dt = new Date(); ad.setAdminTarih(dt); sesi.update(ad); tr.commit(); JOptionPane.showMessageDialog(rootPane, "Kaydetme lemi Baarl "); } else { JOptionPane.showMessageDialog(rootPane, "Ltfen ifreyi Kontrol Ediniz"); } } } catch (Exception e) { System.err.println("Kaydetme Hatas " + e); } }
From source file:backend.api.FinanceManagement.java
public void editUser(Users user) // ok { Session session = sf.openSession(); try {/* w ww .j a v a 2 s . c o m*/ Transaction tx = session.beginTransaction(); session.update(user); tx.commit(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } }
From source file:backend.api.FinanceManagement.java
public void editGroup(Groups newData) // ok { Session session = sf.openSession(); try {//from ww w . ja v a 2 s. c o m Transaction tx = session.beginTransaction(); session.update(newData); tx.commit(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } }
From source file:backend.api.Statistics.java
public void setRecords(Monitoring m) { Session session = sf.openSession(); try {/* w w w. ja va 2 s. c om*/ Transaction tx = session.beginTransaction(); session.update(m); tx.commit(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } }