List of usage examples for org.hibernate Query setInteger
@Deprecated @SuppressWarnings("unchecked") default Query<R> setInteger(String name, int val)
From source file:br.com.hslife.clickafacil.dao.ProdutoDao.java
License:Open Source License
public List listarPorId(Integer id) throws Exception { String hql = "from Produto where idCategoria = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.ProdutoDao.java
License:Open Source License
public Produto buscarPorId(Integer id) throws Exception { String hql = "from Produto where idProduto = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Produto) q.uniqueResult(); }
From source file:br.com.hslife.clickafacil.dao.ProdutoDao.java
License:Open Source License
public List buscarPorGrupo(Integer id) throws Exception { String hql = "from Produto where idGrupo = :idGru"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("idGru", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.ProdutoDao.java
License:Open Source License
public List buscarPorCategoria(Integer id) throws Exception { String hql = "from Produto where idCategoria = :idCat"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("idCat", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.PromocaoDao.java
License:Open Source License
public List listarPorIdProduto(Integer id) throws Exception { String hql = "from Promocao where idProduto = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.PromocaoDao.java
License:Open Source License
public List listarPorIdLoja(Integer id) throws Exception { String hql = "from Promocao where idLoja = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.PromocaoDao.java
License:Open Source License
public Promocao buscarPorId(Integer id) throws Exception { String hql = "from Promocao where idPromocao = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Promocao) q.uniqueResult(); }
From source file:br.com.hslife.imobiliaria.dao.impl.HibernateGenericDao.java
License:Open Source License
public List queryList(String namedQuery, Map<String, Object> params) { HibernateUtility.getSession().clear(); Query query = HibernateUtility.getSession().getNamedQuery(namedQuery); for (String key : params.keySet()) { if (params.get(key) instanceof String) { query.setString(key, (String) params.get(key)); }//w w w . ja v a2 s. c om if (params.get(key) instanceof Long) { query.setLong(key, (Long) params.get(key)); } if (params.get(key) instanceof Integer) { query.setInteger(key, (Integer) params.get(key)); } if (params.get(key) instanceof Boolean) { query.setBoolean(key, (Boolean) params.get(key)); } if (params.get(key) instanceof Double) { query.setDouble(key, (Double) params.get(key)); } if (params.get(key) instanceof Date) { query.setDate(key, (Date) params.get(key)); } } return query.list(); }
From source file:br.com.hslife.imobiliaria.dao.impl.HibernateGenericDao.java
License:Open Source License
public void queryNoResult(String namedQuery, Map<String, Object> params) { Query query = HibernateUtility.getSession().getNamedQuery(namedQuery); for (String key : params.keySet()) { if (params.get(key) instanceof String) { query.setString(key, (String) params.get(key)); }//from www.ja va 2 s . c om if (params.get(key) instanceof Long) { query.setLong(key, (Long) params.get(key)); } if (params.get(key) instanceof Integer) { query.setInteger(key, (Integer) params.get(key)); } if (params.get(key) instanceof Boolean) { query.setBoolean(key, (Boolean) params.get(key)); } if (params.get(key) instanceof Double) { query.setDouble(key, (Double) params.get(key)); } if (params.get(key) instanceof Date) { query.setDate(key, (Date) params.get(key)); } } query.executeUpdate(); HibernateUtility.getSession().flush(); HibernateUtility.getSession().clear(); }
From source file:br.com.hslife.imobiliaria.dao.impl.HibernateGenericDao.java
License:Open Source License
public Object queryUnique(String namedQuery, Map<String, Object> params) { HibernateUtility.getSession().clear(); Query query = HibernateUtility.getSession().getNamedQuery(namedQuery); for (String key : params.keySet()) { if (params.get(key) instanceof String) { query.setString(key, (String) params.get(key)); }/*from www.j av a2 s .c o m*/ if (params.get(key) instanceof Long) { query.setLong(key, (Long) params.get(key)); } if (params.get(key) instanceof Integer) { query.setInteger(key, (Integer) params.get(key)); } if (params.get(key) instanceof Boolean) { query.setBoolean(key, (Boolean) params.get(key)); } if (params.get(key) instanceof Double) { query.setDouble(key, (Double) params.get(key)); } if (params.get(key) instanceof Date) { query.setDate(key, (Date) params.get(key)); } } return query.uniqueResult(); }