List of usage examples for org.hibernate Query setParameter
@SuppressWarnings("unchecked") Query<R> setParameter(int position, Object val);
From source file:cgi.lemans.portail.domaine.gamaweb.impl.AbsenceDao.java
public List<Absence> findAbsenceByUser(String idRessource) { String hql = "from Absence a " + "where a.refRessource.idRessource = :idRessource "; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); List<Absence> results = (List<Absence>) query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.AbsenceDao.java
@Override public Double findAbsenceByTypeByRessource(String idRessource, String type) { String hql = "SELECT sum(a.nombreJourAbsence) as pris " + "from Absence a " + "where YEAR(a.premierJourAbsence)= :annee " + "and a.refTypeAbsence.idTypeAbsence = :type " + "and a.refRessource.id = :idRessource "; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); query.setParameter("annee", Calendar.getInstance().get(Calendar.YEAR)); query.setParameter("type", Integer.parseInt(type)); Double results = (Double) query.uniqueResult(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufControleIncoherenceDao.java
@Override public List<CufControleIncoherence> findNbIncoherence(String idRessource) { String hql = "from CufControleIncoherence a " + "where a.dateDerniereDetection = :dateToday " + "and a.idRessource = :idRessource"; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); query.setDate("dateToday", new java.util.Date()); List<CufControleIncoherence> results = (List<CufControleIncoherence>) query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufPlanningDao.java
@Override public List<CufPlanning> findListDemandePlanning(String tag) { String hql = "from CufPlanning a " + "where a.equipePlanning " + "like :equipeChoisie "; Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + tag + '%'); List<CufPlanning> results = query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufPlanningDao.java
@Override public List<CufPlanning> findTotalPlan(String tag) { String hql = "select a.idRessource, a.noSem, count(a.chargePlanifie)" + "from CufPlanning a " + "where a.equipePlanning " + "like :equipeChoisie " ;/*from w w w .ja v a2s .c o m*/ Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + tag + '%'); List<CufPlanning> results = (List<CufPlanning>) query.list(); CufPlanning number = (CufPlanning) results.get(0); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufPlanningDao.java
public List<CufPlanning> findListIDDemandePlanning(String tag) { String hql = "from CufPlanning a " + "where a.equipePlanning " + "like :equipeChoisie " + " and a.idDemande =: id" ;/* w ww. j a v a 2 s . c om*/ Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + tag + '%'); List<CufPlanning> results = query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.CufRessourceAbsenceDao.java
@Override public CufRessourceAbsence findCufRessourceAbsenceByTypeByRessource(String idRessource, String type) { String hql = "from CufRessourceAbsence a " + "where a.annee= :annee " + "and a.typeAbsence.idTypeAbsence = :type " + "and a.ressourceTma.idRessource = :idRessource "; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); query.setParameter("annee", Calendar.getInstance().get(Calendar.YEAR)); query.setParameter("type", Integer.parseInt(type)); CufRessourceAbsence results = (CufRessourceAbsence) query.uniqueResult(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.DemandeOuProjetDao.java
@Override public List<DemandeOuProjet> findListDemande(String tag) { String hql = "select a from DemandeOuProjet a " + "left join a.refRessource ref " + "where ref.tags " + "like :equipeChoisie " + "and a.dernierEtat != 'TER'" + "and a.typeDemande not in('PRV')"; Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + tag + '%'); List<DemandeOuProjet> results = (List<DemandeOuProjet>) query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.OrdreDeTravailDao.java
@Override public List<OrdreDeTravail> findAllDemande(String idRessource) { String hql = "from OrdreDeTravail a " + "where a.typeActivite!='HTM' " + "and a.ressource.idRessource = :idRessource"; Query query = getSession().createQuery(hql); query.setParameter("idRessource", idRessource); System.out.println(query.getQueryString()); List<OrdreDeTravail> results = query.list(); return results; }
From source file:cgi.lemans.portail.domaine.gamaweb.impl.OrdreDeTravailDao.java
@Override public List<OrdreDeTravail> findAllDemandeEquipe(String tag) { String hql = "from OrdreDeTravail a " + "where a.ressource.tags " + "like :equipeChoisie " + "and a.typeActivite != 'HTM' " + "and a.chargeRestante != 0"; Query query = getSession().createQuery(hql); query.setParameter("equipeChoisie", '%' + tag + '%'); List<OrdreDeTravail> results = query.list(); return results; }