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

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

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

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

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

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

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

@Override
public List findByCodePostale(String codePostal) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("Responsable.findByCodePostale");
    query.setParameter("codePostale", codePostal);
    return query.list();
}

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

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

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

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

@Override
public ResponsableEnfant findByIdresponsableEnfant(int idResponsableEnfant) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("ResponsableEnfant.findByIdresponsableEnfant");
    query.setParameter("idresponsableEnfant", idResponsableEnfant);
    return (ResponsableEnfant) query.uniqueResult();
}

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

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

@Override
public TypeResponsable findByIdtypeResponsable(int idTypeResponsable) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("TypeResponsable.findByIdtypeResponsable");
    query.setParameter("idtypeResponsable", idTypeResponsable);
    return (TypeResponsable) query.uniqueResult();
}

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

@Override
public List findByLibelle(String libelle) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.getNamedQuery("TypeResponsable.findAll");
    query.setParameter("libelle", libelle);
    return query.list();
}