Example usage for org.hibernate Query setLong

List of usage examples for org.hibernate Query setLong

Introduction

In this page you can find the example usage for org.hibernate Query setLong.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setLong(String name, long val) 

Source Link

Document

Bind a named long-valued parameter.

Usage

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public ExBoletimDoc consultarBoletimPorDocumento(ExDocumento doc) {
    final Query query = getSessao().getNamedQuery("consultarBoletimPorDocumento");

    query.setLong("idDoc", doc.getIdDoc());

    final List<ExBoletimDoc> l = query.list();
    if (l.size() != 1)
        return null;

    return l.get(0);
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExBoletimDoc> consultarBoletimPorBoletim(ExDocumento doc) {
    final Query query = getSessao().getNamedQuery("consultarBoletimPorBoletim");

    query.setLong("idDoc", doc.getIdDoc());

    return query.list();
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExEmailNotificacao> consultarEmailNotificacao(DpPessoa pess, DpLotacao lot) {
    final Query query;

    if (pess != null) {
        query = getSessao().getNamedQuery("consultarEmailporPessoa");
        query.setLong("idPessoaIni", pess.getIdPessoaIni());
    } else {//  ww  w .  j  a v a 2 s .  co  m
        query = getSessao().getNamedQuery("consultarEmailporLotacao");

        query.setLong("idLotacaoIni", lot.getIdLotacaoIni());
    }

    return query.list();
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExPreenchimento> consultar(ExPreenchimento exPreenchimento) {
    try {//from  w w w .j a va  2s.c o  m
        final Query query = getSessao().getNamedQuery("consultarPorFiltroExPreenchimento");
        if (exPreenchimento.getNomePreenchimento() != null)
            query.setString("nomePreenchimento",
                    exPreenchimento.getNomePreenchimento().toUpperCase().replace(' ', '%'));
        else
            query.setString("nomePreenchimento", "");
        if (exPreenchimento.getDpLotacao() != null)
            query.setLong("lotacao", exPreenchimento.getDpLotacao().getIdLotacao());
        else
            query.setLong("lotacao", 0);
        if (exPreenchimento.getExModelo() != null)
            query.setLong("modelo", exPreenchimento.getExModelo().getHisIdIni());
        else
            query.setLong("modelo", 0);
        final List<ExPreenchimento> l = query.list();
        return l;
    } catch (final NullPointerException e) {
        return null;
    }
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public ExClassificacao consultarAtual(final ExClassificacao o) {
    try {//w ww  .jav  a2  s.  com
        final Query query = getSessao().getNamedQuery("consultarAtualPorId");
        query.setLong("idRegIni", o.getHisIdIni());
        return (ExClassificacao) query.uniqueResult();
    } catch (final NullPointerException e) {
        return null;
    }
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List consultarMovimentacoesPorLotacaoEntreDatas(// DpPessoa titular,
        DpLotacao lotaTitular, Date dtIni, Date dtFim) {
    try {/*from   w  w w .  jav  a 2  s . c  om*/
        final Query query = getSessao().getNamedQuery("consultarMovimentacoesPorLotacaoEntreDatas");
        if (lotaTitular.getIdLotacaoIni() != null)
            query.setLong("lotaTitular", lotaTitular.getIdLotacaoIni());
        else
            query.setLong("lotaTitular", 0);

        return query.list();
    } catch (final NullPointerException e) {
        return null;
    }
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public ExTpDocPublicacao consultarPorModelo(ExModelo mod) {
    try {//from  www .jav  a 2  s.c o  m
        final Query query = getSessao().getNamedQuery("consultarPorModelo");
        query.setLong("idMod", mod.getHisIdIni());

        return (ExTpDocPublicacao) query.list().get(0);
    } catch (final Throwable t) {
        // engolindo a exceo. Melhorar isso.
        return null;
    }
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExDocumento> listarSolicitados(CpOrgaoUsuario orgaoUsu) {
    final Query query = getSessao().getNamedQuery("listarSolicitados");
    query.setLong("idOrgaoUsu", orgaoUsu.getIdOrgaoUsu());
    return query.list();
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExMobil> consultarParaArquivarCorrenteEmLote(DpLotacao lot) {
    final Query query = getSessao().getNamedQuery(

            "consultarParaArquivarCorrenteEmLote");
    query.setLong("lotaIni", lot.getIdLotacaoIni());
    return query.list();
}

From source file:br.gov.jfrj.siga.hibernate.ExDao.java

License:Open Source License

public List<ExItemDestinacao> consultarParaArquivarIntermediarioEmLote(DpLotacao lot, int offset) {
    final Query query = getSessao().getNamedQuery("consultarParaArquivarIntermediarioEmLote");
    query.setLong("idOrgaoUsu", lot.getOrgaoUsuario().getIdOrgaoUsu());
    query.setFirstResult(offset);/* w w  w.jav a2 s.c o m*/
    query.setMaxResults(100);
    List<Object[]> results = query.list();
    List<ExItemDestinacao> listaFinal = new ArrayList<ExItemDestinacao>();
    for (Object[] result : results) {
        listaFinal.add(new ExItemDestinacao(result));
    }
    return listaFinal;
}