List of usage examples for org.hibernate Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:com.mimp.hibernate.HiberFamilia.java
public Short numAsistentesFormulario(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//w w w . j a va 2 s . c o m int temp = 0; String hql = "From FormularioSesion FS WHERE FS.familia = :id order by FS.idformularioSesion DESC"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); query.setMaxResults(1); FormularioSesion qryResult = (FormularioSesion) query.uniqueResult(); temp = temp + qryResult.getAsistentes().size(); return (short) temp; }
From source file:com.mimp.hibernate.HiberFamilia.java
public ArrayList<AsistenciaFR> listaReunionesInscritasFamilia(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//www .j a va 2 s . co m String hql = "From AsistenciaFR AFR WHERE AFR.familia = :id order by AFR.id ASC"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); List reuniones = query.list(); ArrayList<AsistenciaFR> allReuniones = new ArrayList(); for (Iterator iter = reuniones.iterator(); iter.hasNext();) { AsistenciaFR temp = (AsistenciaFR) iter.next(); Hibernate.initialize(temp.getReunion()); allReuniones.add(temp); } return allReuniones; }
From source file:com.mimp.hibernate.HiberFamilia.java
public int AsistentesPorFormulario(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/* ww w . j a v a2 s.c om*/ int temp = 0; String hql = "From FormularioSesion FS WHERE FS.familia = :id order by FS.idformularioSesion DESC"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); query.setMaxResults(1); FormularioSesion qryResult = (FormularioSesion) query.uniqueResult(); if (qryResult != null) temp = temp + qryResult.getAsistentes().size(); return temp; }
From source file:com.mimp.hibernate.HiberFamilia.java
public FormularioSesion ultimoFormulario(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/*from w w w .j a va 2s .co m*/ int temp = 0; String hql = "From FormularioSesion FS WHERE FS.familia = :id order by FS.idformularioSesion DESC"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); query.setMaxResults(1); FormularioSesion qryResult = (FormularioSesion) query.uniqueResult(); Hibernate.initialize(qryResult.getAsistentes()); return qryResult; }
From source file:com.mimp.hibernate.HiberFamilia.java
public Familia obtenerFormulariosFamilia(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/*from www .j a v a 2s . co m*/ String hql = "From Familia F WHERE F.idfamilia = :id"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); Familia qryResult = (Familia) query.uniqueResult(); Hibernate.initialize(qryResult.getFormularioSesions()); return qryResult; }
From source file:com.mimp.hibernate.HiberFamilia.java
public Sesion getSesionDeFormulario(long idForm) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from w w w . j a v a 2s.c om Sesion tempSesion = new Sesion(); String hql = "From FormularioSesion FS WHERE FS.idformularioSesion = :id"; Query query = session.createQuery(hql); query.setLong("id", idForm); query.setMaxResults(1); FormularioSesion qryResult = (FormularioSesion) query.uniqueResult(); Hibernate.initialize(qryResult.getSesion()); tempSesion = qryResult.getSesion(); return tempSesion; }
From source file:com.mimp.hibernate.HiberFamilia.java
public ExpedienteFamilia getExpFam(long idFam) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();// w w w .j av a 2s. c o m ExpedienteFamilia tempExpFam = new ExpedienteFamilia(); String hql = "From ExpedienteFamilia EF WHERE EF.familia = :id order by EF.idexpedienteFamilia desc"; Query query = session.createQuery(hql); query.setLong("id", idFam); query.setMaxResults(1); tempExpFam = (ExpedienteFamilia) query.uniqueResult(); return tempExpFam; }
From source file:com.mimp.hibernate.HiberFamilia.java
public ArrayList<PostAdopcion> getListaPostAdopcion(long idFam) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from w ww . j a va 2 s.c om String hql = "From PostAdopcion P WHERE P.familia = :id order by P.idpostAdopcion desc"; Query query = session.createQuery(hql); query.setLong("id", idFam); List listPost = query.list(); ArrayList<PostAdopcion> allPost = new ArrayList(); for (Iterator iter = listPost.iterator(); iter.hasNext();) { PostAdopcion temp = (PostAdopcion) iter.next(); allPost.add(temp); } return allPost; }
From source file:com.mimp.hibernate.HiberFamilia.java
public ArrayList<Evaluacion> getEvaluaciones(long idExpFam) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from www . jav a2s . com String hql = "From Evaluacion E WHERE E.expedienteFamilia = :id"; Query query = session.createQuery(hql); query.setLong("id", idExpFam); List listEv = query.list(); ArrayList<Evaluacion> allEv = new ArrayList(); for (Iterator iter = listEv.iterator(); iter.hasNext();) { Evaluacion temp = (Evaluacion) iter.next(); allEv.add(temp); } return allEv; }
From source file:com.mimp.hibernate.HiberFamilia.java
public ArrayList<Designacion> getDesignaciones(long idExpFam) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/*from w w w . jav a 2s. co m*/ String hql = "From Designacion E WHERE E.expedienteFamilia = :id"; Query query = session.createQuery(hql); query.setLong("id", idExpFam); List listDeg = query.list(); ArrayList<Designacion> allDeg = new ArrayList(); for (Iterator iter = listDeg.iterator(); iter.hasNext();) { Designacion temp = (Designacion) iter.next(); allDeg.add(temp); } return allDeg; }