List of usage examples for org.hibernate Query setParameter
@SuppressWarnings("unchecked") Query<R> setParameter(int position, Object val);
From source file:bitirme.dao.AdminDao.java
public Admin girisKontrol(Admin admin) { session = HibernateUtil.getSessionFactory().openSession(); String sorgu = "Select a from Admin a WHERE k_adi = :k_adi AND k_parola= :k_parola"; try {//from w ww . jav a 2 s. c o m Query q = session.createQuery(sorgu); q.setParameter("k_adi", admin.getKAdi()); q.setParameter("k_parola", admin.getKParola()); Admin u = (Admin) q.uniqueResult(); session.close(); return u; } catch (Exception e) { session.close(); return null; } }
From source file:bitirme.dao.FotografDao.java
public List<Fotograf> list(Integer idKullanici) { session = HibernateUtil.getSessionFactory().openSession(); String sorgu = "Select f FROM Fotograf f " + "join f.kullaniciidKullanici k " + "where k.idKullanici = :idKullanici"; List<Fotograf> liste = null; Query q = session.createQuery(sorgu); q.setParameter("idKullanici", idKullanici); liste = q.list();/* w w w. ja v a2s.c o m*/ session.close(); return liste; }
From source file:bitirme.dao.FotografDao.java
public boolean sil(Integer idKullanici) { session = HibernateUtil.getSessionFactory().openSession(); String sorgu = "delete Fotograf f where f.kullaniciidKullanici = :idKullanici "; Kullanici k = kdao.getwId(idKullanici); Query q = session.createQuery(sorgu); q.setParameter("idKullanici", k); q.executeUpdate();// ww w. j ava2 s.c om session.close(); return true; }
From source file:bo.com.kibo.dal.impl.AreaHibernateDAO.java
@Override public Integer getIdPorCodigo(String codigo) { Query query = getSession().createQuery("SELECT id from Area a WHERE a.codigo = :codigo"); query.setParameter("codigo", codigo); return (Integer) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.AreaHibernateDAO.java
@Override public boolean checkId(Integer id) { Query query = getSession().createQuery("SELECT 1 from Area a WHERE a.id = :id"); query.setParameter("id", id); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.AreaHibernateDAO.java
@Override public String getCodigo(Integer id) { Query query = getSession().createQuery("SELECT codigo from Area a WHERE a.id = :id"); query.setParameter("id", id); return (String) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.AreaHibernateDAO.java
@Override public Area recuperarPorCodigo(String codigo) { Query query = getSession().createQuery("from Area a WHERE a.codigo = :codigo"); query.setParameter("codigo", codigo); return (Area) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.CalidadHibernateDAO.java
@Override public Integer getIdPorCodigo(String codigo) { Query query = getSession().createQuery("SELECT id from Calidad c WHERE c.codigo = :codigo"); query.setParameter("codigo", codigo); return (Integer) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.CalidadHibernateDAO.java
@Override public boolean checkId(Integer id) { Query query = getSession().createQuery("SELECT 1 from Calidad c WHERE c.id = :id"); query.setParameter("id", id); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.CalidadHibernateDAO.java
@Override public String getCodigo(Integer id) { Query query = getSession().createQuery("SELECT codigo from Calidad c WHERE c.id = :id"); query.setParameter("id", id); return (String) query.uniqueResult(); }