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.EnfantSessionDaoImpl.java

@Override
public EnfantSession findByIdenfantSession(int idEnfantSession) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("EnfantSession.findByIdenfantSession");
    query.setParameter("idenfantSession", idEnfantSession);
    return (EnfantSession) query.uniqueResult();
}

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

@Override
public HashMap findAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("Etablissement.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.EtablissementDaoImpl.java

@Override
public Etablissement findByIdetablissement(int idEtablissement) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Etablissement.findByIdetablissement");
    query.setParameter("idetablissement", idEtablissement);
    return (Etablissement) query.uniqueResult();
}

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

@Override
public HashMap findAll() {
    Session session = sessionFactory.getCurrentSession();
    HashMap result = new HashMap();
    Query query = session.getNamedQuery("Inscription.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.InscriptionDaoImpl.java

@Override
public Inscription findByIdinscription(int idInscription) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Inscription.findByIdinscription");
    query.setParameter("idinscription", idInscription);
    return (Inscription) query.uniqueResult();
}

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

public List listAll() {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Personnel.findAll");
    return query.list();
}

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

public Personnel FindById(int idpersonnel) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Personnel.findByIdpersonnel");
    query.setParameter("idpersonnel", idpersonnel);
    return (Personnel) query.uniqueResult();

}

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

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

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

@Override
public List findAll() {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Responsable.findAll");
    return query.list();
}

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

@Override
public Responsable findByIdresponsable(int idResponsable) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Responsable.findByIdresponsable");
    query.setParameter("idresponsable", idResponsable);
    return (Responsable) query.uniqueResult();
}