Example usage for org.hibernate Session getNamedQuery

List of usage examples for org.hibernate Session getNamedQuery

Introduction

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

Prototype

org.hibernate.Query getNamedQuery(String queryName);

Source Link

Document

Create a Query instance for the named query.

Usage

From source file:com.levinas.ecole.dao.AnneeScolaireDaoImpl.java

@Override
public AnneeScolaire findByIdanneeScolaire(int idAnneeScolaire) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("AnneeScolaire.findByIdanneeScolaire");
    query.setParameter("idanneeScolaire", idAnneeScolaire);
    return (AnneeScolaire) query.uniqueResult();
}

From source file:com.levinas.ecole.dao.AnneeScolaireEnfantDaoImpl.java

@Override
public HashMap findAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("AnneeScolaireEnfant.findAll");
    double nbResult = query.list().size();
    List listItems = query.list();

    result.put("items", listItems);
    //result.put("page_count", Math.ceil(nbResult/iRpp.doubleValue()));
    result.put("total_items", nbResult);
    return result;
}

From source file:com.levinas.ecole.dao.AnneeScolaireEnfantDaoImpl.java

@Override
public List<AnneeScolaireEnfant> findByIdresponsable(Responsable responsable) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("AnneeScolaireEnfant.findByIdresponsable");
    return query.list();
}

From source file:com.levinas.ecole.dao.AnneeScolaireEnfantDaoImpl.java

@Override
public AnneeScolaireEnfant findByIdanneeScolaireEnfant(int idAnneeScolaireEnfant) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("AnneeScolaireEnfant.findByIdanneeScolaireEnfant");
    query.setParameter("idanneeScolaireEnfant", idAnneeScolaireEnfant);
    return (AnneeScolaireEnfant) query.uniqueResult();
}

From source file:com.levinas.ecole.dao.ClasseDaoImpl.java

@Override
public HashMap findAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("Classe.findAll");
    double nbResult = query.list().size();
    List listItems = query.list();

    result.put("items", listItems);
    //result.put("page_count", Math.ceil(nbResult/iRpp.doubleValue()));
    result.put("total_items", nbResult);
    return result;
}

From source file:com.levinas.ecole.dao.ClasseDaoImpl.java

@Override
public Classe findByIdclasse(int idClasse) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Classe.findByIdclasse");
    query.setParameter("idclasse", idClasse);
    return (Classe) query.uniqueResult();
}

From source file:com.levinas.ecole.dao.EnfantDaoImpl.java

@Override
public HashMap listAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("Enfant.findAll");
    double nbResult = query.list().size();
    List listItems = query.list();

    result.put("items", listItems);
    //result.put("page_count", Math.ceil(nbResult/iRpp.doubleValue()));
    result.put("total_items", nbResult);
    return result;
}

From source file:com.levinas.ecole.dao.EnfantDaoImpl.java

@Override
public Enfant FindById(int idEnfant) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Enfant.findByIdEnfant");
    query.setParameter("idEnfant", idEnfant);
    return (Enfant) query.uniqueResult();

}

From source file:com.levinas.ecole.dao.EnfantDaoImpl.java

@Override
public List findByNom(String nom) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Enfant.findByNom");
    query.setParameter("nom", nom);
    return query.list();
}

From source file:com.levinas.ecole.dao.EnfantSessionDaoImpl.java

@Override
public HashMap findAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("EnfantSession.findAll");
    double nbResult = query.list().size();
    List listItems = query.list();

    result.put("items", listItems);
    //result.put("page_count", Math.ceil(nbResult/iRpp.doubleValue()));
    result.put("total_items", nbResult);
    return result;
}