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.HiberPersonal.java
public FormularioSesion getFormulario(long idFormulario) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from w ww . j a v a2 s. co m String hql = "FROM FormularioSesion F where F.id = :id"; Query query = session.createQuery(hql); query.setLong("id", idFormulario); Object queryResult = query.uniqueResult(); FormularioSesion tempFs = (FormularioSesion) queryResult; Hibernate.initialize(tempFs.getAsistentes()); return tempFs; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Turno getTurno(long idTurno) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/*from ww w . ja v a 2 s.co m*/ String hql = "FROM Turno T where T.id = :id"; Query query = session.createQuery(hql); query.setLong("id", idTurno); Object queryResult = query.uniqueResult(); Turno tempTurno = (Turno) queryResult; return tempTurno; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Turno getTurnoAsistencias(long idTurno) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/* w ww . j av a 2 s . c o m*/ String hql = "FROM Turno T where T.id = :id"; Query query = session.createQuery(hql); query.setLong("id", idTurno); Object queryResult = query.uniqueResult(); Turno tempTurno = (Turno) queryResult; Hibernate.initialize(tempTurno.getAsistenciaFTs()); return tempTurno; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<AsistenciaFT> getAFT(long idFormulario) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from www. ja v a2s . com String hql = "FROM AsistenciaFT A where A.formularioSesion = :id"; Query query = session.createQuery(hql); query.setLong("id", idFormulario); List asistencias = query.list(); ArrayList<AsistenciaFT> allAsistencias = new ArrayList(); for (Iterator iter = asistencias.iterator(); iter.hasNext();) { AsistenciaFT temp = (AsistenciaFT) iter.next(); allAsistencias.add(temp); } return allAsistencias; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<AsistenciaFR> getAsistFR(long idFamilia, long idReunion) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();/* w ww . j a va 2 s . co m*/ String hql = "From AsistenciaFR AFR where AFR.familia = :idFamilia and AFR.reunion = :idReunion"; Query query = session.createQuery(hql); query.setLong("idFamilia", idFamilia); query.setLong("idReunion", idReunion); List asistencias = query.list(); ArrayList<AsistenciaFR> allAsistencias = new ArrayList(); for (Iterator iter = asistencias.iterator(); iter.hasNext();) { AsistenciaFR temp = (AsistenciaFR) iter.next(); allAsistencias.add(temp); } return allAsistencias; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Entidad getEntidad(long id) { Session session = sessionFactory.getCurrentSession(); Entidad Ent = new Entidad(); session.beginTransaction();// w ww.j a v a 2s .c o m String hqlC = "FROM Entidad E WHERE E.id = :id"; Query queryC = session.createQuery(hqlC); queryC.setLong("id", id); Object queryResultC = queryC.uniqueResult(); Ent = (Entidad) queryResultC; return Ent; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<Log> getLogParticular(long idPersonal) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//from www . j av a 2 s.com String hql = "FROM Log L where L.personal = :id"; Query query = session.createQuery(hql); query.setLong("id", idPersonal); List log = query.list(); ArrayList<Log> allLogsParticular = new ArrayList(); for (Iterator iter = log.iterator(); iter.hasNext();) { Log temp = (Log) iter.next(); Hibernate.initialize(temp.getPersonal()); temp.getPersonal().getNombre(); temp.getPersonal().getApellidoP(); allLogsParticular.add(temp); } return allLogsParticular; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<Log> getLogParticularPorDia(long idPersonal, String dia) { timeStampFormat timestamp = new timeStampFormat(); Session session = sessionFactory.getCurrentSession(); session.beginTransaction();// www . ja v a 2 s . co m String diain = dia + " 00:00:00"; String diafin = dia + " 23:59:59"; String hql = "FROM Log L where L.personal = :id and L.fecha >= :diain and L.fecha <= :diafin"; Query query = session.createQuery(hql); query.setLong("id", idPersonal); query.setTimestamp("diain", timestamp.stringToTimestampLog(diain)); query.setTimestamp("diafin", timestamp.stringToTimestampLog(diafin)); List log = query.list(); ArrayList<Log> allLogsParticularPorDia = new ArrayList(); for (Iterator iter = log.iterator(); iter.hasNext();) { Log temp = (Log) iter.next(); Hibernate.initialize(temp.getPersonal()); allLogsParticularPorDia.add(temp); } return allLogsParticularPorDia; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Familia getFamilia(long idFamilia) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();// w w w . j av a 2s . co m String hql = "FROM Familia F where F.id = :id"; Query query = session.createQuery(hql); query.setLong("id", idFamilia); Object queryResult = query.uniqueResult(); Familia tempFa = (Familia) queryResult; return tempFa; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Taller getTallerByIdReunion(long id) { Session session = sessionFactory.getCurrentSession(); Reunion reun = new Reunion(); session.beginTransaction();//from ww w . java2 s . co m String hql = "From Reunion R where R.id = :id"; Query query = session.createQuery(hql); query.setLong("id", id); Object queryResult = query.uniqueResult(); reun = (Reunion) queryResult; Hibernate.initialize(reun.getTurno2().getGrupo().getTaller()); Taller tempT = reun.getTurno2().getGrupo().getTaller(); return tempT; }