Example usage for org.hibernate Query setLong

List of usage examples for org.hibernate Query setLong

Introduction

In this page you can find the example usage for org.hibernate Query setLong.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setLong(String name, long val) 

Source Link

Document

Bind a named long-valued parameter.

Usage

From source file:com.mimp.hibernate.HiberFamilia.java

public ArrayList<Resolucion> getResoluciones(long idExpFam) {
    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/* ww w. ja  va 2  s . c  o m*/

    String hql = "From Resolucion R WHERE R.evaluacion = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idExpFam);
    List listRes = query.list();
    ArrayList<Resolucion> allRes = new ArrayList();
    for (Iterator iter = listRes.iterator(); iter.hasNext();) {
        Resolucion temp = (Resolucion) iter.next();
        allRes.add(temp);
    }
    return allRes;
}

From source file:com.mimp.hibernate.HiberMain.java

public Turno getTurno(long id) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();//www  .  j a  v a 2 s .c om
    String queryTurno = "FROM Turno T WHERE T.id = :id ";
    Query query = session.createQuery(queryTurno);
    query.setLong("id", id);
    Object queryResult = query.uniqueResult();
    Turno temp = (Turno) queryResult;
    Hibernate.initialize(temp.getSesion());
    Hibernate.initialize(temp.getAsistenciaFTs());
    return temp;
}

From source file:com.mimp.hibernate.HiberMain.java

public ArrayList<Asistente> listaAsistentes(long id) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();//from  ww w.  java 2  s . c  om

    String hql = "FROM Asistente A where A.formularioSesion.sesion.idsesion = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", id);
    List asistentes = query.list();
    ArrayList<Asistente> allAsistentes = new ArrayList();
    for (Iterator iter = asistentes.iterator(); iter.hasNext();) {
        Asistente temp = (Asistente) iter.next();
        Hibernate.initialize(temp.getFormularioSesion());
        allAsistentes.add(temp);
    }
    return allAsistentes;

}

From source file:com.mimp.hibernate.HiberMain.java

public ArrayList<Turno> turnosSesion(long idSesion) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();/*from  ww w .j  av a 2 s  .c om*/
    String hql = "From Turno T where T.sesion = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idSesion);
    List asistentes = query.list();
    ArrayList<Turno> allTurnos = new ArrayList();
    for (Iterator iter = asistentes.iterator(); iter.hasNext();) {
        Turno temp = (Turno) iter.next();
        Hibernate.initialize(temp.getAsistenciaFTs());
        allTurnos.add(temp);
    }
    return allTurnos;

}

From source file:com.mimp.hibernate.HiberMain.java

public InfoFamilia getInfoFamPorIdFamilia(long idFamilia) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//from  w  w  w .j  ava2  s. c o m
    InfoFamilia temp = new InfoFamilia();

    String hql = "from InfoFamilia IF where IF.familia = :id ORDER BY IF.idinfoFamilia DESC";
    Query query = session.createQuery(hql);
    query.setLong("id", idFamilia);
    query.setMaxResults(1);
    Object queryResult = query.uniqueResult();
    temp = (InfoFamilia) queryResult;
    Hibernate.initialize(temp.getFamilia());
    Hibernate.initialize(temp.getAdoptantes());
    //Hibernate.initialize(temp.getHijoActs());
    //Hibernate.initialize(temp.getResidenteActs());

    return temp;
}

From source file:com.mimp.hibernate.HiberMain.java

public InfoFamilia getInfoFamPorIdPropio(long idInfoFam) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from   w  ww. ja  v a2s.  c  om*/
    InfoFamilia temp = new InfoFamilia();

    String hql = "from InfoFamilia IF where IF.idinfoFamilia = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idInfoFam);
    Object queryResult = query.uniqueResult();
    temp = (InfoFamilia) queryResult;

    return temp;
}

From source file:com.mimp.hibernate.HiberMain.java

public ArrayList<Atencion> getListaAtencionesPorFamilia(long idFam) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();// w w w.  j  a v  a 2  s  .c  o m
    String hql = "From Atencion A where A.familia = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idFam);
    List atenciones = query.list();
    ArrayList<Atencion> allAtenciones = new ArrayList();
    for (Iterator iter = atenciones.iterator(); iter.hasNext();) {
        Atencion temp = (Atencion) iter.next();
        Hibernate.initialize(temp.getPersonal());
        allAtenciones.add(temp);
    }
    return allAtenciones;

}

From source file:com.mimp.hibernate.HiberMain.java

public Atencion getAtencion(long idAtencion) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();/*www  .  j  a v  a  2s .  c o m*/
    Atencion temp = new Atencion();
    String hql = "From Atencion A where A.idatencion = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idAtencion);
    Object queryResult = query.uniqueResult();
    temp = (Atencion) queryResult;
    Hibernate.initialize(temp.getPersonal());

    return temp;

}

From source file:com.mimp.hibernate.HiberMain.java

public ArrayList<Sesion> getListaSesionesPorFamilia(long idFam) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();//from w  w  w .  ja v a 2 s. c o  m
    String hql = "From FormularioSesion FS where FS.familia = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idFam);
    List formularios = query.list();
    ArrayList<Sesion> allSesiones = new ArrayList();

    for (Iterator iter = formularios.iterator(); iter.hasNext();) {
        FormularioSesion temp = (FormularioSesion) iter.next();
        Hibernate.initialize(temp.getSesion());
        allSesiones.add(temp.getSesion());
    }

    return allSesiones;

}

From source file:com.mimp.hibernate.HiberMain.java

public ArrayList<AsistenciaFR> getListaAsistenciaFRPorFamilia(long idFam) {

    Session session = sessionFactory.getCurrentSession();

    session.beginTransaction();/*from  w w  w .  ja v  a2s.c  o m*/
    String hql = "From AsistenciaFR AFR where AFR.familia = :id";
    Query query = session.createQuery(hql);
    query.setLong("id", idFam);
    List asistencia = query.list();
    ArrayList<AsistenciaFR> allAsistenciaFR = new ArrayList();

    for (Iterator iter = asistencia.iterator(); iter.hasNext();) {
        AsistenciaFR temp = (AsistenciaFR) iter.next();
        Hibernate.initialize(temp.getReunion().getTurno2().getGrupo().getTaller());
        allAsistenciaFR.add(temp);
    }

    return allAsistenciaFR;

}