List of usage examples for org.hibernate Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public int consultarQuantidade(final CpGrupoDaoFiltro o) { try {//from w w w.j a va 2s.c om final Query query; if (o.getNome() != null) { query = getSessao().getNamedQuery("consultarQuantidadeCpGrupoPorCpTipoGrupoIdENome"); query.setString("siglaGrupo", o.getNome()); } else { query = getSessao().getNamedQuery("consultarQuantidadeCpGrupoPorCpTipoGrupoId"); } if (o.getIdTpGrupo() != null) { query.setLong("idTpGrupo", o.getIdTpGrupo()); } else { query.setLong("idTpGrupo", 0); } final int l = ((Long) query.uniqueResult()).intValue(); return l; } catch (final NullPointerException e) { return 0; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<CpGrupo> consultarPorFiltro(final CpGrupoDaoFiltro o, final int offset, final int itemPagina) { try {//from w w w . ja v a 2s .c o m final Query query; if (o.getNome() != null) { query = getSessao().getNamedQuery("consultarCpGrupoPorCpTipoGrupoIdENome"); query.setString("siglaGrupo", o.getNome()); } else { query = getSessao().getNamedQuery("consultarCpGrupoPorCpTipoGrupoId"); } if (offset > 0) { query.setFirstResult(offset); } if (itemPagina > 0) { query.setMaxResults(itemPagina); } if (o.getIdTpGrupo() != null) { query.setLong("idTpGrupo", o.getIdTpGrupo()); } else { query.setLong("idTpGrupo", 0); } final List<CpGrupo> l = query.list(); return l; } catch (final NullPointerException e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public DpPessoa consultarPorCpf(final long cpf) { final Query qry = getSessao().getNamedQuery("consultarPorCpf"); qry.setLong("cpfPessoa", cpf); final DpPessoa pes = (DpPessoa) qry.uniqueResult(); return pes;/* w w w . j a v a2s. c om*/ }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public DpPessoa consultarPorSigla(final DpPessoa o) { try {/* w ww .j av a 2 s .c o m*/ final Query query = getSessao().getNamedQuery("consultarPorSiglaDpPessoa"); query.setString("sesb", o.getSesbPessoa()); query.setLong("matricula", o.getMatricula()); /* * if (o.getOrgaoUsuario().getIdOrgaoUsu() != null) * query.setLong("idOrgaoUsu", o.getOrgaoUsuario().getIdOrgaoUsu()); * else query.setLong("idOrgaoUsu", 0); */ final List<DpPessoa> l = query.list(); if (l.size() != 1) return null; return l.get(0); } catch (final NullPointerException e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public DpPessoa consultarPorIdInicial(final Long idInicial) { try {// w w w .ja v a 2 s . co m final Query query = getSessao().getNamedQuery("consultarPorIdInicialDpPessoa"); query.setLong("idPessoaIni", idInicial); query.setCacheable(true); query.setCacheRegion(CACHE_QUERY_HOURS); final List<DpPessoa> l = query.list(); if (l.size() != 1) return null; return l.get(0); } catch (final NullPointerException e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<DpPessoa> consultarPorIdInicialInclusiveFechadas(final Long idInicial) { try {/*www. jav a 2s .c o m*/ final Query query = getSessao().getNamedQuery("consultarPorIdInicialDpPessoaInclusiveFechadas"); query.setLong("idPessoaIni", idInicial); return query.list(); } catch (final NullPointerException e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public DpPessoa consultarPorIdInicialInclusiveLotacaoFechada(final Long idInicial) { try {/* www . j av a 2 s. c o m*/ final Query query = getSessao().getNamedQuery("consultarPorIdInicialDpLotacaoInclusiveFechada"); query.setLong("idPessoaIni", idInicial); final List<DpPessoa> l = query.list(); if (l.size() != 1) return null; return l.get(0); } catch (final NullPointerException e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public CpPersonalizacao consultarPersonalizacao(DpPessoa pes) { final Query query = getSessao().getNamedQuery("consultarPersonalizacao"); query.setLong("idPessoaIni", pes.getIdPessoaIni()); // query.setCacheable(true); // query.setCacheRegion("query.CpPersonalizacao"); final List<CpPersonalizacao> l = query.list(); if (l.size() != 1) return null; return l.get(0); }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<DpPessoa> consultarAtivasNaDataOrgao(final Date dt, final CpOrgaoUsuario org) { final Query query; query = getSessao().getNamedQuery("consultarAtivasNaDataOrgao"); query.setLong("idOrgaoUsu", org.getIdOrgaoUsu()); query.setDate("dt", dt); return query.list(); }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<DpPessoa> consultarPorFiltro(final DpPessoaDaoFiltro flt, final int offset, final int itemPagina) { try {/* w w w . j a va 2 s . c o m*/ final Query query; if (!flt.isBuscarFechadas()) query = getSessao().getNamedQuery("consultarPorFiltroDpPessoa"); else query = getSessao().getNamedQuery("consultarPorFiltroDpPessoaInclusiveFechadas"); if (offset > 0) { query.setFirstResult(offset); } if (itemPagina > 0) { query.setMaxResults(itemPagina); } query.setString("nome", flt.getNome().toUpperCase().replace(' ', '%')); if (!flt.isBuscarFechadas()) query.setString("situacaoFuncionalPessoa", flt.getSituacaoFuncionalPessoa()); if (flt.getIdOrgaoUsu() != null) query.setLong("idOrgaoUsu", flt.getIdOrgaoUsu()); else query.setLong("idOrgaoUsu", 0); if (flt.getLotacao() != null) query.setLong("lotacao", flt.getLotacao().getId()); else query.setLong("lotacao", 0); final List<DpPessoa> l = query.list(); return l; } catch (final NullPointerException e) { return null; } }