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.HiberOrganismo.java
public Evaluacion EvalPorIDEval(long idEval) { Session session = sessionFactory.getCurrentSession(); Evaluacion eval = new Evaluacion(); session.beginTransaction();/*from w ww . j av a2s .com*/ String hqlO = "FROM Evaluacion E WHERE E.id = :id"; Query queryO = session.createQuery(hqlO); queryO.setLong("id", idEval); Object queryResultA = queryO.uniqueResult(); eval = (Evaluacion) queryResultA; Hibernate.initialize(eval.getEvalLegals()); Hibernate.initialize(eval.getResolucions()); return eval; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Autoridad getAutoridad(long id) { Session session = sessionFactory.getCurrentSession(); Autoridad aut = new Autoridad(); session.beginTransaction();/*from w w w. j a v a 2 s . c o m*/ String hqlA = "FROM Autoridad A WHERE A.id = :id"; Query queryA = session.createQuery(hqlA); queryA.setLong("id", id); Object queryResultA = queryA.uniqueResult(); aut = (Autoridad) queryResultA; Hibernate.initialize(aut.getEntidad()); return aut; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Organismo getOrganismo(long id) { Session session = sessionFactory.getCurrentSession(); Organismo org = new Organismo(); session.beginTransaction();//from www . j a v a2s.c om String hqlO = "FROM Organismo O WHERE O.id = :id"; Query queryO = session.createQuery(hqlO); queryO.setLong("id", id); Object queryResultA = queryO.uniqueResult(); org = (Organismo) queryResultA; Hibernate.initialize(org.getEntidad()); Hibernate.initialize(org.getRepresentantes()); return org; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Organismo getOrganismobyentidad(long id) { Session session = sessionFactory.getCurrentSession(); Organismo org = new Organismo(); session.beginTransaction();/* www .j av a 2 s . c om*/ String hqlO = "FROM Organismo O WHERE O.entidad = :id"; Query queryO = session.createQuery(hqlO); queryO.setLong("id", id); Object queryResultA = queryO.uniqueResult(); org = (Organismo) queryResultA; return org; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Representante getRepresentantebyOrganismo(long id) { Session session = sessionFactory.getCurrentSession(); Representante rep = new Representante(); session.beginTransaction();/* w ww. jav a 2s . com*/ String hqlO = "FROM Representante R WHERE R.organismo = :id"; Query queryO = session.createQuery(hqlO); queryO.setLong("id", id); Object queryResultA = queryO.uniqueResult(); rep = (Representante) queryResultA; return rep; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Car getCar(long id) { Session session = sessionFactory.getCurrentSession(); Car car = new Car(); session.beginTransaction();/*from w w w . ja v a2 s .co m*/ String hqlC = "FROM Car C WHERE C.id = :id"; Query queryC = session.createQuery(hqlC); queryC.setLong("id", id); Object queryResultC = queryC.uniqueResult(); car = (Car) queryResultC; return car; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Juzgado getJuzgado(long id) { Session session = sessionFactory.getCurrentSession(); Juzgado juzg = new Juzgado(); session.beginTransaction();//from w w w . ja v a2 s . c om String hqlJ = "FROM Juzgado J WHERE J.id = :id"; Query queryJ = session.createQuery(hqlJ); queryJ.setLong("id", id); Object queryResultJ = queryJ.uniqueResult(); juzg = (Juzgado) queryResultJ; return juzg; }
From source file:com.mimp.hibernate.HiberPersonal.java
public Unidad getUa(long id) { Session session = sessionFactory.getCurrentSession(); Unidad ua = new Unidad(); session.beginTransaction();// w w w . jav a2 s . c o m String hqlU = "FROM Unidad U WHERE U.id = :id"; Query queryU = session.createQuery(hqlU); queryU.setLong("id", id); Object queryResultU = queryU.uniqueResult(); ua = (Unidad) queryResultU; return ua; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<Personal> ListaPersonalUa(long idUa) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();//w w w .jav a2 s. c o m String hql = "FROM Personal P where P.unidad = :id"; Query query = session.createQuery(hql); query.setLong("id", idUa); List pers = query.list(); ArrayList<Personal> allPersonal = new ArrayList(); for (Iterator iter = pers.iterator(); iter.hasNext();) { Personal temp = (Personal) iter.next(); Hibernate.initialize(temp.getUnidad()); allPersonal.add(temp); } return allPersonal; }
From source file:com.mimp.hibernate.HiberPersonal.java
public ArrayList<Personal> ListaPersonalNoUa(long idUa) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction();// w w w . j a v a2 s .co m String hql = "FROM Personal P where not P.unidad = :id"; Query query = session.createQuery(hql); query.setLong("id", idUa); List pers = query.list(); ArrayList<Personal> allPersonal = new ArrayList(); for (Iterator iter = pers.iterator(); iter.hasNext();) { Personal temp = (Personal) iter.next(); Hibernate.initialize(temp.getUnidad()); allPersonal.add(temp); } return allPersonal; }