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.bluesoft.pronto.dao.TicketDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Ticket> buscar(String busca, final Integer kanbanStatusKey, final Integer clienteKey, final TicketOrdem ordem, final Classificacao classificacao) { final StringBuilder hql = new StringBuilder(); hql.append(" select distinct t from Ticket t "); hql.append(" left join fetch t.sprint "); hql.append(" left join fetch t.reporter "); hql.append(" left join fetch t.tipoDeTicket as tipoDeTicket "); hql.append(" left join fetch t.backlog as b "); hql.append(" left join fetch t.kanbanStatus as kanbanStatus "); hql.append(" left join fetch t.filhos "); hql.append(" left join fetch t.cliente as cliente "); hql.append(" where upper(t.titulo) like :query "); if (kanbanStatusKey != null) { if (kanbanStatusKey == -1) { hql.append(" and t.dataDePronto is null "); } else if (kanbanStatusKey > 0) { hql.append(" and t.kanbanStatus.kanbanStatusKey = :kanbanStatusKey "); }//from w ww . j ava2 s. com } if (clienteKey != null && clienteKey > 0) { hql.append(" and t.cliente.clienteKey = :clienteKey "); } hql.append(buildOrdem(ordem, classificacao)); busca = busca == null ? "" : busca; final Query query = getSession().createQuery(hql.toString()).setString("query", '%' + busca.toUpperCase() + '%'); if (kanbanStatusKey != null && kanbanStatusKey > 0) { query.setInteger("kanbanStatusKey", kanbanStatusKey); } if (clienteKey != null && clienteKey > 0) { query.setInteger("clienteKey", clienteKey); } return query.list(); }
From source file:br.com.bluesoft.pronto.dao.TicketDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Ticket> listarPorCliente(final int clienteKey) { final StringBuilder builder = new StringBuilder(); builder.append(" select distinct t from Ticket t"); builder.append(" left join fetch t.filhos f "); builder.append(" left join fetch t.pai p"); builder.append(" where t.backlog.backlogKey != 4 and t.pai is null"); builder.append(" and t.cliente.clienteKey = :clienteKey"); builder.append(" order by t.prioridadeDoCliente"); final Query query = getSession().createQuery(builder.toString()); query.setInteger("clienteKey", clienteKey); return query.list(); }
From source file:br.com.financeiro.dao.CategoriaDAOHibernate.java
@Override public List<Categoria> listar(Usuario usuario) { String hql = "select c from Categoria c where c.pai is null and c.usuario = :usuario"; Query query = this.session.createQuery(hql); query.setInteger("usuario", usuario.getCodigo()); List<Categoria> lista = query.list(); return lista; }
From source file:br.com.hslife.clickafacil.dao.CategoriaDao.java
License:Open Source License
public Categoria buscarPorId(Integer id) throws Exception { String hql = "from Categoria where idCategoria = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Categoria) q.list().get(0); }
From source file:br.com.hslife.clickafacil.dao.CategoriaDao.java
License:Open Source License
public List listarPorGrupo(Integer id) throws Exception { String hql = "from Categoria where idGrupo = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.FuncionarioDao.java
License:Open Source License
public Funcionario buscarPorId(Integer id) throws Exception { String hql = "from Funcionario where idFuncionario = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Funcionario) q.list().get(0); }
From source file:br.com.hslife.clickafacil.dao.FuncionarioDao.java
License:Open Source License
public Funcionario buscarPorIdInfAdic(Integer id) throws Exception { String hql = "from Funcionario where idInfoAdci = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Funcionario) q.list().get(0); }
From source file:br.com.hslife.clickafacil.dao.FuncionarioDao.java
License:Open Source License
public List listarPorLoja(Integer id) throws Exception { String hql = "from Funcionario where idLoja = :idLoj"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("idLoj", id); return q.list(); }
From source file:br.com.hslife.clickafacil.dao.InfoAdicionaisDao.java
License:Open Source License
public InfoAdicionais buscarPorId(Integer id) throws Exception { String hql = "from InfoAdicionais where idInfoAdic = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (InfoAdicionais) q.list().get(0); }
From source file:br.com.hslife.clickafacil.dao.InternautaDao.java
License:Open Source License
public Internauta buscarIdInternauta(Integer id) throws Exception { String hql = "from Internauta where idLogin = :id"; Query q = HibernateUtil.getInstance().createQuery(hql); q.setInteger("id", id); return (Internauta) q.list().get(0); }