List of usage examples for org.hibernate Session createQuery
@Override org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
From source file:ayarlar.ayarlar.java
public void enter() { if (jPasswordField1.getText().equals("")) { JOptionPane.showMessageDialog(rootPane, "Ltfen Kullanc ifrenizi Giriniz "); } else {// w w w . ja v a 2 s. c o m SessionFactory sf = NewHibernateUtil.getSessionFactory(); Session sesi = sf.openSession(); Transaction tr = sesi.beginTransaction(); List<Admin> ls = sesi.createQuery("from Admin").list(); for (Admin item : ls) { String sifre = item.getAdminSifre(); String ssifre = MD5(jPasswordField1.getText()); if (sifre.equals(ssifre)) { JOptionPane.showMessageDialog(rootPane, "Bilgilerinizi Gncelleyebilirsiniz "); new yeniAyarlar().setVisible(true); } else { JOptionPane.showMessageDialog(rootPane, "Kullanc ifreniz Yanl"); jPasswordField1.setText(""); jTextField5.requestFocus(); } } } }
From source file:ayarlar.yeniAyarlar.java
public void datagetir() { SessionFactory sf = NewHibernateUtil.getSessionFactory(); Session sesi = sf.openSession(); Transaction tr = sesi.beginTransaction(); List<Admin> ls = sesi.createQuery("from Admin").list(); for (Admin item : ls) { jTextField6.setText(item.getAdminAdi()); jTextField7.setText(item.getAdminSoyadi()); jTextField1.setText(item.getAdminMail()); jTextField2.setText(item.getAdminTelefon()); jTextField3.setText(item.getAdminKadi()); jTextField4.requestFocus();// w w w. j a va2 s.c o m } tr.commit(); }
From source file:Baari.DbAccess.java
public List haeKannasta(String hql) { if (!alustettu) { alustaHibernate();/*from w w w . ja va 2s . c o m*/ } Session session = alustaSessio(); Query query = session.createQuery(hql); List list = query.list(); // closeConnection(); return list; }
From source file:backend.api.FinanceManagement.java
public List<Users> getAllUsers() // ok { Session s = sf.openSession(); try {//from www . ja va 2s.com Query query = s.createQuery("select u from Users u"); List<Users> users = query.list(); if (users.isEmpty() || users.size() == 0) return null; return users; } catch (Exception e) { e.printStackTrace(); return null; } finally { s.close(); } }
From source file:backend.api.FinanceManagement.java
public Users getUser(int idUser) // ok { Session s = sf.openSession(); try {/*from w ww . j a va2 s . c o m*/ Query q = s.createQuery("select u from Users u where " + idUser + "=u.idusers"); List<Users> result = q.list(); if (result.isEmpty() || result.size() == 0) return null; return (Users) result.get(0); } catch (Exception e) { e.printStackTrace(); return null; } finally { s.close(); } }
From source file:backend.api.FinanceManagement.java
public List<Users> getUsers(int IdGroup) //ok { Session s = SessionFactoryManager.INSTANCE.getSessionFactory().openSession(); try {// w w w .j av a 2 s. c o m String hql = "select new backend.core.model.Users(u.idusers, u.name, u.surname, u.password, u.salt, u.hired, u.last_login) " + "from Users u join u.Groups g where g.idgroups in (:idGroup)"; Query q = s.createQuery(hql); q.setParameter("idGroup", IdGroup); List<Users> result = q.list(); if (result.isEmpty() || result.size() == 0) return null; return result; } catch (Exception e) { e.printStackTrace(); return null; } finally { s.close(); } }
From source file:backend.api.FinanceManagement.java
public List<Groups> getGroup() //ok { Session s = SessionFactoryManager.INSTANCE.getSessionFactory().openSession(); try {// www .jav a2 s . c om Query q = s.createQuery("select g from Groups g"); List<Groups> result = q.list(); if (result.isEmpty() || result.size() == 0) return null; return result; } catch (Exception e) { e.printStackTrace(); return null; } finally { s.close(); } }
From source file:backend.api.FinanceManagement.java
public List<FinanceRegister> getFinanceRegisterRecords() // ok { Session s = SessionFactoryManager.INSTANCE.getSessionFactory().openSession(); try {// w w w. j av a 2 s .co m Query q = s.createQuery("select f from FinanceRegister f"); List<FinanceRegister> result = q.list(); if (result.isEmpty() || result.size() == 0) return null; return result; } catch (Exception e) { e.printStackTrace(); return null; } finally { s.close(); } }
From source file:backend.api.Statistics.java
public List<Monitoring> getRecords() { Session s = sf.openSession(); try {// w w w .j a va2 s . c om Query query = s.createQuery("select m from Monitoring m"); List<Monitoring> monitor = query.list(); if (monitor.isEmpty() || monitor.size() == 0) return null; return monitor; } finally { s.close(); } }
From source file:backend.api.Statistics.java
public List<MonitoringWorkers> getRecordsMonitoringWorkers() { Session s = sf.openSession(); try {/* w w w . ja va 2 s . c o m*/ Query query = s.createQuery("select m from MonitoringWorkers m"); List<MonitoringWorkers> monitor = query.list(); if (monitor.isEmpty() || monitor.size() == 0) return null; return monitor; } finally { s.close(); } }