Example usage for org.hibernate Session createQuery

List of usage examples for org.hibernate Session createQuery

Introduction

In this page you can find the example usage for org.hibernate Session createQuery.

Prototype

@Override
    org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);

Source Link

Usage

From source file:br.com.proj.tasker.dao.impl.PerfilDAO.java

@Override
public Perfil buscaSuperv() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Perfil perfil = (Perfil) session.createQuery("from Perfil where id_perf = 3").uniqueResult();
    session.close();//w w  w  .j  a v a  2s .  c  o m
    return perfil;
}

From source file:br.com.proj.tasker.dao.impl.PerfilDAO.java

@Override
public Perfil buscaFunc() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Perfil perfil = (Perfil) session.createQuery("from Perfil where id_perf = 4").uniqueResult();
    session.close();/*  w w  w .j av  a 2s .c o  m*/
    return perfil;
}

From source file:br.com.proj.tasker.dao.impl.PerfilDAO.java

@Override
public List<Perfil> buscarTodos(Perfil perfil) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    return session.createQuery("from Perfil").list();
}

From source file:br.com.proj.tasker.dao.impl.PessoaDAO.java

@Override
public Pessoa listarPorIdUser(Integer id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Pessoa pessoa = (Pessoa) session.createQuery("from Pessoa where id_user = :id").setParameter("id", id)
            .uniqueResult();//from w  ww  .jav  a2  s  . c  o m
    session.close();
    return pessoa;
}

From source file:br.com.proj.tasker.dao.impl.PessoaDAO.java

@Override
public List<Pessoa> listarTodos() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    List<Pessoa> pessoas = session.createQuery("from Pessoa").list();
    session.close();//w ww .  ja  va  2 s . com
    return pessoas;
}

From source file:br.com.proj.tasker.dao.impl.PlanoDAO.java

@Override
public List<Plano> buscarTodos(Plano plano) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    return session.createQuery("from Plano").list();
}

From source file:br.com.proj.tasker.dao.impl.PlanoDAO.java

@Override
public List<Plano> buscarListPlano(Plano plano) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    return session.createQuery("from plano where id_plan = :id").list();
}

From source file:br.com.proj.tasker.dao.impl.PlanoDAO.java

@Override
public Plano buscarPlano(int i) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    return (Plano) session.createQuery("from Plano where id_plan = :id").setParameter("id", i).uniqueResult();
}

From source file:br.com.proj.tasker.dao.impl.ProjetoDAO.java

@Override
public List<Projeto> buscaProjGru(Integer id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    List<Projeto> projs = session.createQuery(
            "Select pro from Projeto as pro JOIN pro.grupo as gru WHERE gru.idGrupo = :id AND pro.ativo = 't'")
            .setParameter("id", id).list();
    session.close();/*from  w ww  . ja v a2 s .c o  m*/
    return projs;
}

From source file:br.com.proj.tasker.dao.impl.TarefaDAO.java

@Override
public List<Tarefa> buscaTarProj(Integer id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    List<Tarefa> tars = session.createQuery(
            "Select tar from Tarefa as tar JOIN tar.projeto as pro WHERE pro.idProj = :id AND tar.status<>'Desativada'")
            .setParameter("id", id).list();
    session.close();// w  w  w  .  j  a v  a 2  s  .  co  m
    return tars;
}