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.CategoriaDao.java

public static Integer grabTipoContaPorCategoria(Integer categoria) {

    Session session = null;//from w ww . j  av  a  2s .c  om
    Transaction tx;
    List<LnCategoria> listaCategoria = null;
    Integer tipInCodigo = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();
        Query query = session.getNamedQuery("LnCategoria.findByCatInCodigo");
        query.setInteger("catInCodigo", categoria);
        listaCategoria = query.list();
        tx.commit();
        tipInCodigo = listaCategoria.get(0).getTipInCodigo();

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

    return tipInCodigo;
}

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

public static LnCategoria grabCategoria(Integer idCategoria) {
    Session session = null;/*  www .j a v  a2 s  .  c  om*/
    Transaction tx;
    LnCategoria lnCategoria = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();
        Query query = session.getNamedQuery("LnCategoria.findByCatInCodigo");
        query.setInteger("catInCodigo", idCategoria);
        List list = query.list();
        tx.commit();

        if (list != null && list.size() > 0) {
            lnCategoria = (LnCategoria) list.get(0);
        }
    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return lnCategoria;
}

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

public static LnCliente grabClienteCodigo(Integer cliInCodigo) {

    Session session = null;//from   w ww .j  a  v  a2s.co  m
    Transaction tx = null;
    LnCliente lnCliente = null;

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

        Query query = session.getNamedQuery("LnCliente.findByCliInCodigo");
        query.setInteger("cliInCodigo", cliInCodigo);

        List l = query.list();
        tx.commit();

        if (l != null && !l.isEmpty()) {
            lnCliente = (LnCliente) l.get(0);
        }
    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return lnCliente;
}

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

public static List<LnEndereco> grabListEnderecoCodigoCliente(Integer cliInCodigo) {

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

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

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

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

public static List<LnFavorecido> grabBancos() {
    Session session = null;/*w w w .  j  a v  a2  s  .c o  m*/
    Transaction tx;
    List<LnFavorecido> listaFavorecido = null;

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

        Query query = session.getNamedQuery("LnFavorecido.findByTfaInCodigo");
        query.setInteger("tfaInCodigo", 2);
        listaFavorecido = query.list();
        tx.commit();

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

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

public static LnFavorecido grabFavorecidoCodigo(Integer idFavorecido) {

    Session session = null;/*w  ww.jav a  2s.c  o m*/
    Transaction tx;
    LnFavorecido lnFavorecido = null;

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

        Query query = session.getNamedQuery("LnFavorecido.findByFavInCodigo");
        query.setInteger("favInCodigo", idFavorecido);
        List l = query.list();
        tx.commit();

        if (l != null && l.size() > 0) {
            lnFavorecido = (LnFavorecido) l.get(0);
        }

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

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

public static List<LnHistorico> grabListHistorico(Integer modInCodigo) {

    Session session = null;/*from   w w  w  .  j  a  va 2 s.c o m*/
    Transaction tx = null;
    List<LnHistorico> listHistorico = null;

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

        if (modInCodigo != null) {
            query = session.getNamedQuery("LnHistorico.findByModInCodigo");
            query.setInteger("modInCodigo", modInCodigo);
        } else {
            query = session.getNamedQuery("LnHistorico.findAll");
        }
        listHistorico = query.list();

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

    return listHistorico;
}

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

public static LnModulo getModulo(Integer modInCodigo) {

    Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
    Transaction tx = session.getTransaction();
    LnModulo lnModulo = null;/*  www.java2  s .c  o m*/

    try {
        Query query = session.getNamedQuery("LnModulo.findByModInCodigo");
        query.setInteger("modInCodigo", modInCodigo);

        List list = query.list();

        if (list != null && !list.isEmpty()) {
            lnModulo = (LnModulo) list.get(0);
        }

    } finally {
        if (session.isOpen()) {
            session.close();
        }
    }

    return lnModulo;
}

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

/**
 * Perfil especifico/*from  w w  w. j  a  va2  s  .com*/
 * @param perInCodigo
 * @param perChAtivo
 * @return List Object
 */
public static LnPerfil grabPerfil(Integer perInCodigo, Character perChAtivo) {

    Session session = null;
    Transaction tx = null;
    LnPerfil lnPerfil = null;

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();
        Query query = session.getNamedQuery("LnPerfil.findByPerInCodigoPerChAtivo");
        query.setInteger("perInCodigo", perInCodigo);
        query.setCharacter("perChAtivo", perChAtivo);

        List l = query.list();
        tx.commit();

        if (l != null && !l.isEmpty()) {
            lnPerfil = (LnPerfil) l.get(0);
        }

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

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

/**
 * Perfil e Modulo especifico/*from  w  w  w.ja  v  a  2  s .  c  o m*/
 * @param clazz
 * @param strDbName
 * @return List Object
 */
public static LnPerfilacesso grabPerfilAcesso(Integer perInCodigo, Integer modInCodigo) {

    Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
    Transaction tx = session.beginTransaction();
    LnPerfilacesso lnPerfilAcesso = null;

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

        List l = query.list();

        if (l != null && !l.isEmpty()) {
            lnPerfilAcesso = (LnPerfilacesso) l.get(0);
        }

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