List of usage examples for org.hibernate Session getNamedQuery
org.hibernate.Query getNamedQuery(String queryName);
From source file:br.com.ln.hibernate.Postgress.java
public static List<LnMenu> grabMenu(Character menChAtivo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); List<LnMenu> listMenu = null; try {//from www.ja va 2 s .c o m 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.hibernate.Postgress.java
public static LnPerfil grabPerfil(Integer perInCodigo, Character perChAtivo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfil lnPerfil = null;/*from w w w .j av a 2 s .c o m*/ try { Query query = session.getNamedQuery("LnPerfil.findByPerInCodigoPerChAtivo"); query.setInteger("perInCodigo", perInCodigo); query.setCharacter("perChAtivo", perChAtivo); 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.hibernate.Postgress.java
public static List<LnPerfil> grabListPerfilAtivo(Character perChAtivo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); List<LnPerfil> listPerfil; try {/* w ww.j a v a2 s . c o m*/ Query query = session.getNamedQuery("LnPerfil.findByPerChAtivo"); query.setCharacter("perChAtivo", perChAtivo); listPerfil = query.list(); tx.commit(); } finally { if (session != null && session.isOpen()) { session.close(); } } return listPerfil; }
From source file:br.com.ln.hibernate.Postgress.java
public static LnPerfilacesso grabPerfilAcesso(Integer perInCodigo, Integer modInCodigo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfilacesso lnPerfilAcesso = null; try {//w w w. j a v a 2 s .c om 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.hibernate.Postgress.java
public static List<LnPerfilacesso> grabPerfilAcessoperInCodigo(Integer perInCodigo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); List<LnPerfilacesso> listlnPerfilAcesso = null; try {// w ww .ja va 2s.c o m 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.hibernate.Postgress.java
public static List<LnModulo> grabListModuloAtivo(Character modChAtivo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); List<LnModulo> listlnModulo = null; try {//from w w w . j ava 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 != null && session.isOpen()) { session.close(); } } return listlnModulo; }
From source file:br.com.ln.hibernate.Postgress.java
public static LnPerfil grabPerfilperStDesc(String perStDescricao) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfil lnPerfil = null;/* ww w .ja va 2s .c om*/ 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.hibernate.Postgress.java
public static boolean grabVerificaHistorico(String usuStCodigo) { Session session = null; Transaction tx;/*www . j a va 2 s . c o m*/ List<LnHistorico> listHis; boolean retorno = false; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnHistorico.findByUsuStCodigo"); query.setString("usuStCodigo", usuStCodigo); listHis = query.list(); tx.commit(); System.out.println("lishis : " + listHis.size()); if (listHis != null) { retorno = listHis.size() == 0; } else { retorno = false; } } finally { if (session != null && session.isOpen()) { session.close(); } } return retorno; }
From source file:br.com.ln.hibernate.Postgress.java
public static List<LnUsuario> grabUsuarioPerfil(Integer perInCodigo) { Session session = null; Transaction tx = null;/*from w ww . jav a2s . c om*/ List<LnUsuario> listUsuario = null; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnUsuario.findByPerInCodigo"); query.setInteger("perInCodigo", perInCodigo); listUsuario = query.list(); tx.commit(); } finally { if (session != null && session.isOpen()) { session.close(); } } return listUsuario; }
From source file:br.com.ln.hibernate.Postgress.java
public static List<LnEndereco> grabListEnderecoCliente(Integer cliInCodigo) { Session session = null; Transaction tx = null;//from ww w .j a va 2 s . c om List<LnEndereco> listEnderecos = null; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnEndereco.findByCliInCodigo"); query.setInteger("cliInCodigo", cliInCodigo); listEnderecos = query.list(); tx.commit(); } finally { if (session != null && session.isOpen()) { session.close(); } } return listEnderecos; }