List of usage examples for org.hibernate Query uniqueResult
R uniqueResult();
From source file:br.com.bluesoft.pronto.dao.UsuarioDao.java
License:Open Source License
@Override public Usuario obter(final String username) { final String hql = "select distinct u from Usuario u left join fetch u.papeis where u.username = :username"; final Query query = getSession().createQuery(hql).setString("username", username); return (Usuario) query.uniqueResult(); }
From source file:br.com.caelum.vraptor.mydvds.dao.DefaultUserDao.java
License:Open Source License
public User find(String login, String password) { String hql = "from User u where u.login = :login and u.password = :password"; Query query = session.createQuery(hql).setParameter("login", login).setParameter("password", password); return (User) query.uniqueResult(); }
From source file:br.com.caelum.vraptor.mydvds.dao.DefaultUserDao.java
License:Open Source License
public User find(String login) { String hql = "from User u where u.login = :login"; Query query = session.createQuery(hql).setParameter("login", login); return (User) query.uniqueResult(); }
From source file:br.com.chamados.control.DAO.java
public Object count(String sql) { openSession(); Query query = session.createQuery(sql); return query.uniqueResult(); }
From source file:br.com.construtora.dao.financeiro.DespesasGeralDAO.java
public DespesasGeral findByTipoDespesas(String tipoDespesa) { session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction();/*w ww. ja va 2 s . c o m*/ Query q = session.getNamedQuery("DespesasGeral.findByTpDesp"); q.setParameter("tpDesp", tipoDespesa); DespesasGeral despesasGeral = (DespesasGeral) q.uniqueResult(); session.getTransaction().commit(); return despesasGeral; }
From source file:br.com.construtora.dao.UsuarioDAO.java
public Usuario findByLogin(String login) { session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction();//from w ww. ja va2 s . c o m Query q = session.getNamedQuery("Usuario.findByDeLogi"); q.setString("deLogi", login); Usuario usuario = (Usuario) q.uniqueResult(); session.getTransaction().commit(); return usuario; }
From source file:br.com.droganet.dao.AdministradorDAO.java
public Administrador consultar(String nome) { conexao.beginTransaction();/*from w w w . j a v a 2 s.co m*/ Query query = conexao.createQuery("from Adminsitrador where nomeAdmin = " + nome); Administrador j = (Administrador) query.uniqueResult(); conexao.getTransaction().commit(); return j; }
From source file:br.com.droganet.dao.ClienteDAO.java
public Cliente consultar(String nome) { conexao.beginTransaction();/*w w w . j a va2 s . com*/ Query query = conexao.createQuery("from cliente where nome = " + nome); Cliente j = (Cliente) query.uniqueResult(); conexao.getTransaction().commit(); return j; }
From source file:br.com.droganet.dao.CreditoClienteDAO.java
public CreditoCliente consultar(String nome) { conexao.beginTransaction();/* w w w .ja va2 s . c o m*/ Query query = conexao.createQuery("from creditocliente where nome = " + nome); CreditoCliente j = (CreditoCliente) query.uniqueResult(); conexao.getTransaction().commit(); return j; }
From source file:br.com.droganet.dao.FornecedorDAO.java
public Fornecedor consultar(String nome) { conexao.beginTransaction();/*w ww . j a v a2 s.c o m*/ Query query = conexao.createQuery("from fornecedor where nome = " + nome); Fornecedor j = (Fornecedor) query.uniqueResult(); conexao.getTransaction().commit(); return j; }