List of usage examples for org.hibernate Query setParameter
@SuppressWarnings("unchecked") Query<R> setParameter(int position, Object val);
From source file:bo.com.kibo.dal.impl.CargaHibernateDAO.java
@Override public Integer getIdPorCodigo(String codigo) { Query query = getSession().createQuery("SELECT id from Carga c WHERE c.codigo = :codigo"); query.setParameter("codigo", codigo); return (Integer) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.CargaHibernateDAO.java
@Override public boolean checkId(Integer id) { Query query = getSession().createQuery("SELECT 1 from Carga c WHERE c.id = :id"); query.setParameter("id", id); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.CargaHibernateDAO.java
@Override public String getCodigo(Integer id) { Query query = getSession().createQuery("SELECT codigo from Carga c WHERE c.id = :id"); query.setParameter("id", id); return (String) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.EspecieHibernateDAO.java
@Override public Integer getIdPorNombre(String nombre) { Query query = getSession().createQuery("SELECT id from Especie e WHERE e.nombre = :nombre"); query.setParameter("nombre", nombre); return (Integer) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.EspecieHibernateDAO.java
@Override public boolean checkId(Integer id) { Query query = getSession().createQuery("SELECT 1 from Especie e WHERE e.id = :id"); query.setParameter("id", id); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.EspecieHibernateDAO.java
@Override public String getNombre(Integer id) { Query query = getSession().createQuery("SELECT nombre from Especie e WHERE e.id = :id"); query.setParameter("id", id); return (String) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.FajaHibernateDAO.java
@Override public boolean existeFaja(Faja faja) { Query query = getSession().createQuery( "Select 1 From Faja f Where f.area.id = :idArea AND f.numero = :numero AND f.bloque = :bloque"); query.setParameter("idArea", faja.getArea().getId()); query.setParameter("numero", faja.getNumero()); query.setParameter("bloque", faja.getBloque()); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.FajaHibernateDAO.java
@Override public boolean checkId(Integer id) { Query query = getSession().createQuery("SELECT 1 from Faja f WHERE f.id = :id"); query.setParameter("id", id); return (query.uniqueResult() != null); }
From source file:bo.com.kibo.dal.impl.FajaHibernateDAO.java
@Override public Integer getIdPorBloqueYNumero(String bloque, int numero) { Query query = getSession() .createQuery("Select id From Faja f Where f.numero = :numero AND f.bloque = :bloque"); query.setParameter("numero", numero); query.setParameter("bloque", bloque); return (Integer) query.uniqueResult(); }
From source file:bo.com.kibo.dal.impl.FajaHibernateDAO.java
@Override public List<Faja> obtenerFajasSegunArea(Integer idArea) { Query query = getSession().createQuery("from Faja f Where f.area.id = :idArea"); query.setParameter("idArea", idArea); return query.list(); }