List of usage examples for org.hibernate Criteria uniqueResult
public Object uniqueResult() throws HibernateException;
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public Object getUniqUser(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getUniqUser(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(PassExpire.class); criteria.add(Restrictions.eq("username", username)); return criteria.uniqueResult(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public String getRole(String user) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getUniqUser(String user)[" + user + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", user)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("authority")); criteria.setProjection(proList);/*from www.j av a2 s . c o m*/ return criteria.uniqueResult().toString(); }
From source file:br.com.hrstatus.dao.impl.UsersDAO.java
License:Open Source License
public boolean getFirstLogin(String username) { log.fine("[ " + userInfo.getLoggedUsername() + " ] getFirstLogin(String username)[" + username + "]"); final Criteria criteria = session().createCriteria(Users.class); criteria.add(Restrictions.eq("username", username)); final ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("firstLogin")); criteria.setProjection(proList);//from w w w.j a va 2 s .c om return (Boolean) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.AuditoriaRepository.java
License:Open Source License
public Auditoria findById(Long id) { Criteria criteria = getSession().createCriteria(Auditoria.class).setFetchMode("dadosAuditoria", FetchMode.JOIN);/*from w w w . j a v a 2s . c o m*/ criteria.add(Restrictions.eq("id", id)); return (Auditoria) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.CategoriaRepository.java
License:Open Source License
public Categoria findDefaultByTipoCategoriaAndUsuario(Usuario usuario, TipoCategoria tipoCategoria) { Criteria criteria = getSession().createCriteria(Categoria.class); criteria.add(Restrictions.eq("padrao", true)); criteria.add(Restrictions.eq("usuario.id", usuario.getId())); criteria.add(Restrictions.eq("tipoCategoria", tipoCategoria)); return (Categoria) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.ContaRepository.java
License:Open Source License
public Conta findByCartaoCredito(CartaoCredito cartaoCredito) { Criteria criteria = getSession().createCriteria(Conta.class); criteria.add(Restrictions.eq("cartaoCredito.id", cartaoCredito.getId())); return (Conta) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.ItemDespensaRepository.java
License:Open Source License
@Override public ItemDespensa findById(Long id) { Criteria criteria = getSession().createCriteria(ItemDespensa.class).setFetchMode("movimentacao", FetchMode.JOIN);// w ww.j a va2 s . c o m criteria.add(Restrictions.eq("id", id)); return (ItemDespensa) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.MoedaRepository.java
License:Open Source License
public Moeda findDefaultByUsuario(Usuario usuario) { Criteria criteria = getSession().createCriteria(Moeda.class); criteria.add(Restrictions.eq("usuario.id", usuario.getId())); criteria.add(Restrictions.eq("padrao", true)); return (Moeda) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.OpcaoSistemaRepository.java
License:Open Source License
public OpcaoSistema findOpcaoGlobalAdminByChave(String chave) { Criteria criteria = getSession().createCriteria(OpcaoSistema.class); criteria.add(Restrictions.eq("tipoOpcaoSistema", TipoOpcaoSistema.GLOBAL_ADMIN)); criteria.add(Restrictions.eq("chave", chave)); return (OpcaoSistema) criteria.uniqueResult(); }
From source file:br.com.hslife.orcamento.repository.OpcaoSistemaRepository.java
License:Open Source License
public OpcaoSistema findOpcaoUserByChave(String chave, Usuario usuario) { Criteria criteria = getSession().createCriteria(OpcaoSistema.class); criteria.add(Restrictions.eq("tipoOpcaoSistema", TipoOpcaoSistema.USER)); criteria.add(Restrictions.eq("chave", chave)); criteria.add(Restrictions.eq("usuario.id", usuario.getId())); return (OpcaoSistema) criteria.uniqueResult(); }