Example usage for org.hibernate Query setCharacter

List of usage examples for org.hibernate Query setCharacter

Introduction

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

Prototype

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

Source Link

Document

Bind a named char-valued parameter.

Usage

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

public static List<LnCategoria> grabCategoria(Character catChAtivo) {

    Session session = null;/*from w  w w .  j a  v  a  2  s  .com*/
    Transaction tx;
    List<LnCategoria> listCategoria = null;

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

        Query query = session.getNamedQuery("LnCategoria.findByCatChAtivo");
        query.setCharacter("catChAtivo", catChAtivo);
        listCategoria = query.list();
        tx.commit();

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

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

public static List<LnFavorecido> grabListaFavorecidoAtivo() {

    Session session = null;/*from  w w  w .  j  a v  a  2 s .  co  m*/
    Transaction tx;
    List<LnFavorecido> listaFavorecido = null;

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

        Query query = session.getNamedQuery("LnFavorecido.findByFavChAtivo");
        query.setCharacter("favChAtivo", 'S');
        listaFavorecido = query.list();
        tx.commit();
    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }

    return listaFavorecido;
}

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

/**
     * Busca o Menu/*from w w w.ja v  a2  s.  c o  m*/
     * @param clazz
     * @param strDbName
     * @return List Object
     */
public static List<LnMenu> grabMenu(Character menChAtivo) {

    Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
    Transaction tx = session.beginTransaction();
    List<LnMenu> listMenu = null;
    try {
        Query query = session.getNamedQuery("LnMenu.findAllAtivo");
        query.setCharacter("menChAtivo", 'S');
        listMenu = (List<LnMenu>) query.list();

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

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

public static List<LnModulo> grabListModuloAtivo(Character modChAtivo) {

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

    try {/* ww w .ja  v a  2  s.c o  m*/
        Query query = session.getNamedQuery("LnModulo.findAllAtivo");
        query.setCharacter("modChAtivo", modChAtivo);

        List l = query.list();

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

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

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

/**
 * Perfil especifico/*from  w  ww  .  j a  v a  2  s  .  c  o m*/
 * @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

/**
 * grabListPerfilAtivo Get list profile active
 * @param perChAtivo/*from ww w  .  j  ava 2s .  com*/
 * @return List Object
 */

public static List<LnPerfil> grabListPerfilAtivo(Character perChAtivo) {

    Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
    Transaction tx = session.beginTransaction();
    List<LnPerfil> listPerfil;

    try {
        Query query = session.getNamedQuery("LnPerfil.findByPerChAtivo");
        query.setCharacter("perChAtivo", perChAtivo);
        listPerfil = query.list();
        tx.commit();
    } finally {
        if (session.isOpen()) {
            session.close();
        }
    }
    return listPerfil;
}

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

public static List<LnPlanoconta> grabContaAtivo() {

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

    try {
        session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName);
        tx = session.beginTransaction();
        Query query = session.getNamedQuery("LnPlanoconta.findByCtaFinanceiro");
        query.setCharacter("ctaChAtivo", 'S');
        listaPlanoconta = query.list();
        tx.commit();
    } finally {
        if (session != null && session.isOpen()) {
            session.close();
        }
    }
    return listaPlanoconta;
}

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

public static List<LnPlanoconta> grabListaAtivos() {

    Session session = null;//from  w ww .  j a v a2 s. c  om
    Transaction tx;
    List<LnPlanoconta> listaConta;

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

        Query query = session.getNamedQuery("LnPlanoconta.findByAtivo");
        query.setCharacter("ctaChAtivo", 'S');
        listaConta = query.list();

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

    return listaConta;
}

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

/**
 * grabUsuario Get list user for code active.
 * @param usuStCodigo/*w  ww  .j  av a2s.  c  om*/
 * @param usuChAtivo
 * @return 
 */

public static LnUsuario grabUsuario(String usuStCodigo, Character usuChAtivo) {

    Session session = null;
    Transaction tx;
    LnUsuario lnUsuario = null;

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

        Query query = session.getNamedQuery("LnUsuario.findAllUsuStCodigoUsuChAtivo");
        query.setString("usuStCodigo", usuStCodigo);
        query.setCharacter("usuChAtivo", usuChAtivo);

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

        if (l != null && l.size() > 0) {
            lnUsuario = (LnUsuario) l.get(0);
        } else {
            lnUsuario = null;
        }
    } catch (HibernateException ex) {
        logger.error("Hibernate Exception : " + ex.getMessage());
    } finally {

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

From source file:br.com.ln.hibernate.Postgress.java

/**
 * Pesquisa de usuario e senha para validacao.
 * @param usuStCodigo//from  w  w w .  j a v  a  2  s.c o  m
 * @param strDbName
 * @return 
 */

public static LnUsuario grabUsuario(String usuStCodigo, Character usuChAtivo) {

    Session session = null;
    Transaction tx;
    LnUsuario lnUsuario = null;

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

        Query query = session.getNamedQuery("LnUsuario.findAllUsuStCodigoUsuChAtivo");
        query.setString("usuStCodigo", usuStCodigo);
        query.setCharacter("usuChAtivo", usuChAtivo);

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

        if (l != null && l.size() > 0) {
            lnUsuario = (LnUsuario) l.get(0);
        } else {
            lnUsuario = null;
        }
    } catch (HibernateException ex) {
        System.out.println("Hibernate Exception : " + ex.getMessage());
    } finally {

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