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
@SuppressWarnings("unchecked") public List<DpPessoa> consultarPorOrgaoUsuDpPessoaInclusiveFechadas(final long idOrgaoUsu) { try {// w w w . j a va 2 s . c o m final Query query = getSessao().getNamedQuery("consultarPorOrgaoUsuDpPessoaInclusiveFechadas"); query.setLong("idOrgaoUsu", idOrgaoUsu); final List<DpPessoa> 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 int consultarQuantidade(final DpPessoaDaoFiltro flt) { try {/* w ww .ja v a2 s . c om*/ final Query query; if (!flt.isBuscarFechadas()) query = getSessao().getNamedQuery("consultarQuantidadeDpPessoa"); else query = getSessao().getNamedQuery("consultarQuantidadeDpPessoaInclusiveFechadas"); 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 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<DpSubstituicao> consultarSubstituicoesPermitidas(final DpSubstituicao exemplo) throws SQLException { try {//from www.j a v a2 s . c o m Query query = null; query = getSessao().getNamedQuery("consultarSubstituicoesPermitidas"); query.setLong("idSubstitutoIni", exemplo.getSubstituto().getIdPessoaIni()); query.setLong("idLotaSubstitutoIni", exemplo.getLotaSubstituto().getIdLotacaoIni()); // query.setCacheable(true); // query.setCacheRegion(CACHE_QUERY_SUBSTITUICAO); return query.list(); } catch (final IllegalArgumentException e) { throw e; } catch (final Exception e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<DpSubstituicao> consultarOrdemData(final DpSubstituicao exemplo) throws SQLException { try {/* ww w. j av a2 s . c o m*/ Query query = null; query = getSessao().getNamedQuery("consultarOrdemData"); query.setLong("idTitularIni", exemplo.getTitular().getIdPessoaIni()); query.setLong("idLotaTitularIni", exemplo.getLotaTitular().getIdLotacaoIni()); // query.setCacheable(true); // query.setCacheRegion(CACHE_QUERY_SUBSTITUICAO); return query.list(); } catch (final IllegalArgumentException e) { throw e; } catch (final Exception e) { return null; } }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
@SuppressWarnings("unchecked") public List<CpIdentidade> consultaIdentidades(final DpPessoa pessoa) { final Query qry = getSessao().getNamedQuery("consultarIdentidades"); qry.setLong("idPessoaIni", pessoa.getIdInicial()); qry.setCacheable(false);/*from www .jav a 2 s . c om*/ final List<CpIdentidade> lista = qry.list(); return lista; }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public DpPessoa consultarPorCpfMatricula(final long cpf, long matricula) { final Query qry = getSessao().getNamedQuery("consultarPorCpfMatricula"); qry.setLong("cpfPessoa", cpf); qry.setLong("matricula", matricula); final DpPessoa pes = (DpPessoa) qry.uniqueResult(); return pes;//ww w. j a v a 2 s.c o m }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public List<CpConfiguracao> consultar(final CpConfiguracao exemplo) { Query query = getSessao().getNamedQuery("consultarCpConfiguracoes"); query.setLong("idTpConfiguracao", exemplo.getCpTipoConfiguracao().getIdTpConfiguracao()); query.setCacheable(false);/*from www . j a va2 s . c o m*/ // query.setCacheRegion(CACHE_QUERY_CONFIGURACAO); return query.list(); }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public List<CpConfiguracao> consultarConfiguracoesPorTipo(final Long idTipoConfig) { Query query = getSessao().getNamedQuery("consultarCpConfiguracoesPorTipo"); query.setLong("idTpConfiguracao", idTipoConfig); query.setCacheable(false);/*from ww w . j a va 2 s .c o m*/ return query.list(); }
From source file:br.gov.jfrj.siga.dp.dao.CpDao.java
License:Open Source License
public List<CpConfiguracao> porLotacaoPessoaServicoTipo(final CpConfiguracao exemplo) { Query query = getSessao().getNamedQuery("consultarCpConfiguracoesPorLotacaoPessoaServicoTipo"); query.setLong("idPessoa", exemplo.getDpPessoa().getIdPessoa()); query.setLong("idLotacao", exemplo.getLotacao().getIdLotacao()); query.setLong("idTpConfiguracao", exemplo.getCpTipoConfiguracao().getIdTpConfiguracao()); query.setLong("idServico", exemplo.getCpServico().getIdServico()); // kpf: com o cache true, as configuracoes sao exibidas de forma forma // errada apos a primeira query.setCacheable(false);//from www. j a v a 2s. c o m // query.setCacheRegion(CACHE_QUERY_CONFIGURACAO); return query.list(); }
From source file:br.gov.jfrj.siga.dp.dao.CpDaoTest.java
License:Open Source License
public void testPesquisarConfiguracaoPorTipoLotacao() throws AplicacaoException, Exception, IllegalAccessException { CpTipoLotacao t_ctlTipoLotacao = dao.consultar(101L, CpTipoLotacao.class, false); final Query query = dao.getSessao().getNamedQuery("consultarCpConfiguracoesPorTipoLotacao"); query.setLong("idTpLotacao", t_ctlTipoLotacao.getIdTpLotacao()); ArrayList<CpConfiguracao> t_arlConfigServicos = (ArrayList<CpConfiguracao>) query.list(); ArrayList<CpServico> t_arlServicos = new ArrayList<CpServico>(); for (CpConfiguracao t_cfgConfiguracao : t_arlConfigServicos) { t_arlServicos.add(t_cfgConfiguracao.getCpServico()); }//from ww w . j av a 2s . co m assertTrue(t_arlServicos.size() > 0); }