Example usage for org.hibernate Query setInteger

List of usage examples for org.hibernate Query setInteger

Introduction

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

Prototype

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

Source Link

Document

Bind a named int-valued parameter.

Usage

From source file:br.com.ln.dao.PerfilDao.java

/**
 * Perfil de acesso especifico/*from  ww w. j a v  a2 s. co  m*/
 * @param clazz
 * @param strDbName
 * @return List Object
 */
public static List<LnPerfilacesso> grabPerfilAcessoperInCodigo(Integer perInCodigo) {

    Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
    Transaction tx = session.beginTransaction();
    List<LnPerfilacesso> listlnPerfilAcesso = null;

    try {
        Query query = session.getNamedQuery("LnPerfilacesso.findByPerInCodigo");
        query.setInteger("perInCodigo", perInCodigo);

        List l = query.list();

        if (l != null && !l.isEmpty()) {
            listlnPerfilAcesso = l;
        }

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return listlnPerfilAcesso;
}

From source file:br.com.ln.dao.PlanoContaDao.java

public static LnSaldoconta grabSaldoAtualConta(Integer ctaInCodigo) {

    Session session = null;/*  w w  w .jav  a2  s . c  o  m*/
    Transaction tx;
    LnSaldoconta lnSaldoconta = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Date sacDtData = grabBuscaUltimoSaldo(ctaInCodigo);

        Query query = session.getNamedQuery("LnSaldoconta.findByCtaInCodigoSacDtData");
        query.setInteger("ctaInCodigo", ctaInCodigo);
        query.setDate("sacDtData", sacDtData);
        List list = query.list();
        tx.commit();

        if (list != null && list.size() > 0) {
            lnSaldoconta = (LnSaldoconta) list.get(0);
        }

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return lnSaldoconta;
}

From source file:br.com.ln.dao.PlanoContaDao.java

public static LnSaldoconta grabSaldoAtualConta(Integer ctaInCodigo, Date sacDtData) {

    Session session = null;/*from  w  w  w . ja  v  a  2 s . c o m*/
    Transaction tx;
    LnSaldoconta lnSaldoconta = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnSaldoconta.findByCtaInCodigoSacDtData");
        query.setInteger("ctaInCodigo", ctaInCodigo);
        query.setDate("sacDtData", sacDtData);
        List list = query.list();
        tx.commit();

        if (list != null && list.size() > 0) {
            lnSaldoconta = (LnSaldoconta) list.get(0);
        }

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return lnSaldoconta;
}

From source file:br.com.ln.dao.PlanoContaDao.java

private static Date grabBuscaUltimoSaldo(Integer ctaInCodigo) {

    Session session = null;//from   w  w  w  .j a v  a 2s . c o m
    Transaction tx;
    Date dataSaldo = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.createSQLQuery("select max(sac_dt_data) sac_dt_data from ln_saldoconta\n"
                + "where cta_in_codigo = :ctaInCodigo\n");

        query.setInteger("ctaInCodigo", ctaInCodigo);
        List list = query.list();
        tx.commit();

        if (list != null && list.size() > 0) {
            dataSaldo = (Date) list.get(0);
        }

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return dataSaldo;
}

From source file:br.com.ln.dao.TabelaDao.java

public static synchronized List<LnTabela> grabTabela(Integer ttbInCodigo) {

    Session session = null;/*from w w  w  . j  ava  2s  .c om*/
    Transaction tx;
    List<LnTabela> listTabela = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnTabela.findByTtbInCodigo");
        query.setInteger("ttbInCodigo", ttbInCodigo);
        listTabela = query.list();
        tx.commit();

    } finally {
        if (session != null & session.isOpen()) {
            session.close();
        }
    }
    return listTabela;
}

From source file:br.com.ln.dao.TabelaDao.java

public static synchronized List<LnTabelaItem> grabTabelaItem(Integer tabInCodigo) {

    Session session = null;/*from ww  w  .  jav a2 s  .c  o m*/
    Transaction tx = null;
    List<LnTabelaItem> listTabelaItem = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnTabelaItem.findByTabInCodigo");
        query.setInteger("tabInCodigo", tabInCodigo);
        listTabelaItem = query.list();
        tx.commit();

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return listTabelaItem;
}

From source file:br.com.ln.dao.TabelaDao.java

public static synchronized List<LnTabela> grabLnTabelaDate(Integer ttbInCodigo, Date tabDtInicio,
        Date tabDtFinal) {/*  w  w  w.  j a v a  2  s  .c  o m*/
    Session session = null;
    Transaction tx;
    List<LnTabela> listaTabela = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.createQuery(
                "select l from LnTabela l where l.ttbInCodigo = :ttbInCodigo and l.tabDtFinal >= :tabDtFinal");
        query.setInteger("ttbInCodigo", ttbInCodigo);
        query.setDate("tabDtFinal", tabDtFinal);
        listaTabela = query.list();
        tx.commit();

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return listaTabela;
}

From source file:br.com.ln.dao.TelefoneDao.java

public static List<LnTelefone> grabListTelefoneCodigoCliente(Integer cliInCodigo) {

    Session session = null;//  w  ww. jav  a2  s . com
    Transaction tx = null;
    List<LnTelefone> listTelefone = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName("acessocontrol");
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnTelefone.findByCliInCodigo");
        query.setInteger("cliInCodigo", cliInCodigo);
        listTelefone = query.list();
        tx.commit();
    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return listTelefone;
}

From source file:br.com.ln.dao.TipoContaDao.java

public static LnTipoconta grabTipoConta(Integer tipInCodigo) {

    Session session = null;/*from  w w w.  j  a v a 2 s .c  o  m*/
    Transaction tx = null;
    List<LnTipoconta> listTipoConta = null;
    LnTipoconta lnTipoconta = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnTipoconta.findByTipInCodigo");
        query.setInteger("tipInCodigo", tipInCodigo);
        listTipoConta = query.list();
        lnTipoconta = listTipoConta.get(0);
        tx.commit();

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return lnTipoconta;
}

From source file:br.com.ln.dao.TipoFavorecidoDao.java

public static LnTipofavorecido grabTipoFavorecido(Integer tfaInCodigo) {

    Session session = null;/*w  ww  . j a  v  a 2s  .c  o  m*/
    Transaction tx;

    List<LnTipofavorecido> listFavorecido;
    LnTipofavorecido lnTipofavorecido = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();

        Query query = session.getNamedQuery("LnTipofavorecido.findByTfaInCodigo");
        query.setInteger("tfaInCodigo", tfaInCodigo);
        listFavorecido = query.list();
        lnTipofavorecido = listFavorecido.get(0);
        tx.commit();

    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return lnTipofavorecido;
}