List of usage examples for org.hibernate Session getNamedQuery
org.hibernate.Query getNamedQuery(String queryName);
From source file:br.com.ln.dao.PerfilDao.java
/** * Perfil e Modulo especifico//from ww w .j ava2 s . co 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; }
From source file:br.com.ln.dao.PerfilDao.java
/** * Perfil de acesso especifico// w w w .j a va 2 s. com * @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.PerfilDao.java
/** * Descricao do Perfil//from w ww . j a v a2s. c om * @param clazz * @param strDbName * @return List Object */ public static LnPerfil grabPerfilperStDesc(String perStDescricao) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfil lnPerfil = null; try { Query query = session.getNamedQuery("LnPerfil.findByPerStDescricao"); query.setString("perStDescricao", perStDescricao); List l = query.list(); 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.PlanoContaDao.java
public static List<LnPlanoconta> grabContaAtivo() { Session session = null; Transaction tx;/*from ww w. j a v a2 s.c o m*/ 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> grabListaConta() { Session session = null; Transaction tx;/*from ww w . j a va2 s .c o m*/ List<LnPlanoconta> listaPlanoconta = null; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnPlanoconta.findAll"); 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 LnSaldoconta grabSaldoAtualConta(Integer ctaInCodigo) { Session session = null; Transaction tx;/*from w ww .j a v a 2 s . c om*/ 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; Transaction tx;/*from w w w. j av a2 s . c o m*/ 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
public static List<LnPlanoconta> grabListaAtivos() { Session session = null; Transaction tx;/* w w w.j a va 2 s . c o m*/ 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.TabelaDao.java
public static synchronized List<LnTabela> grabTabela(Integer ttbInCodigo) { Session session = null; Transaction tx;//w ww . j av a 2 s .c o m 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; Transaction tx = null;/*from www . j av a 2 s . co m*/ 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; }