List of usage examples for org.hibernate Query setInteger
@Deprecated @SuppressWarnings("unchecked") default Query<R> setInteger(String name, int val)
From source file:br.com.ln.dao.UsuarioDao.java
/** * Get profile in code profile.//from w ww . jav a2 s . c om * @param perInCodigo * @return */ public static List<LnUsuario> grabUsuarioPerfil(Integer perInCodigo) { Session session = null; Transaction tx; 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.dao.UsuarioDao.java
/** * grabListUsuario Get list user for client. * @param cliente//from w w w . j a v a2 s . com * @return */ public static List<LnUsuario> grabListUsuarioCliente(Integer cliente) { Session session = null; Transaction tx; List<LnUsuario> listUsuario = null; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnUsuario.findByCliInCodigo"); query.setInteger("cliInCodigo", cliente); 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 LnPerfil grabPerfil(Integer perInCodigo, Character perChAtivo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfil lnPerfil = null;//from www . j a v 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 LnPerfilacesso grabPerfilAcesso(Integer perInCodigo, Integer modInCodigo) { Session session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); Transaction tx = session.beginTransaction(); LnPerfilacesso lnPerfilAcesso = null; try {/*from w ww .j av a2s . c o m*/ 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 w w. j a va 2 s .co 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<LnUsuario> grabUsuarioPerfil(Integer perInCodigo) { Session session = null;//from w w w.j a v a2s . co m Transaction tx = null; 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;// w w w . j ava 2s . c o m Transaction tx = null; 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; }
From source file:br.com.ln.hibernate.Postgress.java
public static List<LnTelefone> grabListTelefones(Integer cliInCodigo) { Session session = null;/*from ww w.j ava 2s. c o m*/ Transaction tx = null; List<LnTelefone> listTelefones = null; try { session = SessionFactoryDbName.getCurrentSessionByName(VarComuns.strDbName); tx = session.beginTransaction(); Query query = session.getNamedQuery("LnTelefone.findByCliInCodigo"); query.setInteger("cliInCodigo", cliInCodigo); listTelefones = query.list(); } finally { if (session != null && session.isOpen()) { session.close(); } } return listTelefones; }
From source file:br.com.sicva.dao.EnderecoDao.java
public Endereco PesquisarEndereco(Integer id) { try {/*from ww w. ja v a 2 s . c o m*/ session = new FabricaDeConexao().getSessionFactory().openSession(); Query query = session.createSQLQuery("SELECT * \n" + "FROM endereco inner join paciente on PAC_ENDERECO_ID = END_ID \n" + "where PAC_ID = :id") .addEntity(Endereco.class); query.setInteger("id", id); listarEndereco = query.list(); for (Endereco e : listarEndereco) { Hibernate.initialize(e.getBairro()); } session.close(); if (listarEndereco.isEmpty()) { return null; } else { return listarEndereco.get(0); } } catch (Exception e) { System.out.println("" + e.getCause().getMessage()); return null; } }
From source file:br.com.sicva.dao.EnderecosDao.java
public Enderecos consultarPorParciente(int codigo) { session = new HibernateUtil().getSessionFactory().openSession(); Query query = session.createSQLQuery( "select * from enderecos inner join pacientes " + "on PACIENTES_ENDERECOS_ID = ENDERECOS_ID " + "where PACIENTES_NUMERO_REGISTRO_NASCIMENTO = :paciente") .addEntity(Enderecos.class); query.setInteger("paciente", codigo); listarEnderecos = query.list();/*from w w w.j av a2 s . c o m*/ session.close(); return listarEnderecos.get(0); }