Example usage for org.hibernate Criteria uniqueResult

List of usage examples for org.hibernate Criteria uniqueResult

Introduction

In this page you can find the example usage for org.hibernate Criteria uniqueResult.

Prototype

public Object uniqueResult() throws HibernateException;

Source Link

Document

Convenience method to return a single instance that matches the query, or null if the query returns no results.

Usage

From source file:br.com.magmadoctor.modelo.contato.ContatoDAOHibernate.java

@Override
public Contato porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Contato.class).add(Restrictions.eq("id", id));
    Contato contato = (Contato) criteria.uniqueResult();
    return contato;
}

From source file:br.com.magmadoctor.modelo.convenio.ConvenioDAOHibernate.java

@Override
public Convenio porNome(String nome) {
    Criteria criteria = this.session.createCriteria(Convenio.class).add(Restrictions.eq("nomeFantasia", nome));
    Convenio convenio = (Convenio) criteria.uniqueResult();
    return convenio;
}

From source file:br.com.magmadoctor.modelo.convenio.ConvenioDAOHibernate.java

@Override
public Convenio porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Convenio.class).add(Restrictions.eq("id", id));
    Convenio convenio = (Convenio) criteria.uniqueResult();
    return convenio;
}

From source file:br.com.magmadoctor.modelo.documento.DocumentoDAOHibernate.java

@Override
public Documento porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Documento.class).add(Restrictions.eq("id", id));
    Documento documento = (Documento) criteria.uniqueResult();
    return documento;
}

From source file:br.com.magmadoctor.modelo.email.EmailDAOHibernate.java

@Override
public Email porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Email.class).add(Restrictions.eq("id", id));
    Email email = (Email) criteria.uniqueResult();
    return email;
}

From source file:br.com.magmadoctor.modelo.email.EmailDAOHibernate.java

@Override
public Email porNome(String nome) {
    Criteria criteria = this.session.createCriteria(Email.class).add(Restrictions.eq("email", nome));
    Email email = (Email) criteria.uniqueResult();
    return email;
}

From source file:br.com.magmadoctor.modelo.endereco.EnderecoDAOHibernate.java

@Override
public Endereco porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Endereco.class).add(Restrictions.eq("id", id));
    Endereco endereco = (Endereco) criteria.uniqueResult();
    return endereco;
}

From source file:br.com.magmadoctor.modelo.endereco.EnderecoDAOHibernate.java

@Override
public Endereco porNome(String nome) {
    Criteria criteria = this.session.createCriteria(Endereco.class).add(Restrictions.eq("logradouro", nome));
    Endereco endereco = (Endereco) criteria.uniqueResult();
    return endereco;
}

From source file:br.com.magmadoctor.modelo.profissional.ProfissionalDAOHibernate.java

@Override
public Profissional porId(Integer id) {
    Criteria criteria = this.session.createCriteria(Profissional.class).add(Restrictions.eq("id", id));
    Profissional profissional = (Profissional) criteria.uniqueResult();
    return profissional;
}

From source file:br.com.magmadoctor.modelo.profissional.ProfissionalDAOHibernate.java

@Override
public Profissional porNome(String nome) {
    Criteria criteria = this.session.createCriteria(Profissional.class).add(Restrictions.eq("nome", nome));
    Profissional profissional = (Profissional) criteria.uniqueResult();
    return profissional;
}