List of usage examples for org.hibernate Session load
void load(Object object, Serializable id);
From source file:br.com.sescacre.dao.SubPilar1DAO.java
public SubPilares1 pesquisaPorId(Integer id) { Session s = HibernateUtil.getSession(); SubPilares1 sp1 = (SubPilares1) s.load(SubPilares1.class, id); s.close();// w ww. j a v a 2 s . co m return sp1; }
From source file:br.com.sescacre.dao.SubPilar2DAO.java
public SubPilares2 pesquisaPorId(Integer id) { Session s = HibernateUtil.getSession(); SubPilares2 sp2 = (SubPilares2) s.load(SubPilares2.class, id); s.close();/*from w w w . j a v a 2 s .c o m*/ return sp2; }
From source file:br.com.sescacre.sisrelat.dao.UsuariosDao.java
public Usuarios pesquisaPorId(String id) { Session s = HibernateUtil.getSession(); Usuarios u = (Usuarios) s.load(Usuarios.class, id); return u;//from ww w . jav a 2 s . co m }
From source file:br.com.t2ti.balcao.DavController.java
License:Open Source License
public void imprimeDav() { EcfDavCabecalhoVO davCabecalho = (EcfDavCabecalhoVO) this.grid.getForm1().getVOModel().getValueObject(); try {// w w w.j av a2 s . c o m Session session = HibernateUtil.getSessionFactory().openSession(); EcfEmpresaVO empresa = (EcfEmpresaVO) session.load(EcfEmpresaVO.class, 1); HashMap parametros = new HashMap(); parametros.put("NOME_EMPRESA", empresa.getRazaoSocial()); parametros.put("CNPJ_EMPRESA", empresa.getCnpj()); parametros.put("CODIGO_DAV", davCabecalho.getId()); JasperPrint jp = JasperFillManager.fillReport("./relatorios/DAV.jasper", parametros, session.connection()); JasperPrintManager.printPage(jp, 0, false); //JasperViewer jv = new JasperViewer(jp); //jv.viewReport(jp, false); } catch (Exception e) { e.printStackTrace(); } }
From source file:br.edu.ifes.bd2hibernate.cgd.DAO.java
public void deletar(int id, Class c) { Session s = HibernateUtil.getSession(); HibernateUtil.begin();/*w ww.j ava 2 s . c o m*/ Object o = c.cast(s.load(c, new Integer(id))); s.delete(c.cast(o)); HibernateUtil.commit(); HibernateUtil.close(); }
From source file:br.edu.ifsp.dsw.dao.impl.TagDAOImpl.java
@Override public Tag buscarTagPorId(Long id) { Session session = this.sessionFactory.getCurrentSession(); Tag tag = (Tag) session.load(Tag.class, id); logger.info("Tag carregada com sucesso, detalhes=" + tag); return tag;//w w w. ja v a 2s . c o m }
From source file:br.edu.ifsp.dsw.dao.impl.TagDAOImpl.java
@Override public void removerTag(Long id) { Session session = this.sessionFactory.getCurrentSession(); Tag tag = (Tag) session.load(Tag.class, id); if (null != tag) { session.delete(tag);/*from w w w .ja v a2 s.com*/ } logger.info("Tag removida com sucesso, detalhes=" + tag); }
From source file:br.edu.ifsp.dsw.dao.impl.UsuarioDAOImpl.java
@Override public Usuario buscarUsuarioPorId(Integer id) { Session session = this.sessionFactory.getCurrentSession(); Usuario usuario = (Usuario) session.load(Usuario.class, id); logger.info("Usuario carregado com sucesso, detalhes=" + usuario); return usuario; }
From source file:br.edu.ifsp.dsw.dao.impl.UsuarioDAOImpl.java
@Override public void removerUsuario(Integer id) { Session session = this.sessionFactory.getCurrentSession(); Usuario usuario = (Usuario) session.load(Usuario.class, id); if (null != usuario) { session.delete(usuario);/*from w ww . j ava 2s . com*/ } logger.info("Usuario removido com sucesso, detalhes=" + usuario); }
From source file:br.mdarte.exemplo.academico.cd.CursoDAO.java
public List<AbstractEntity> select(long id) throws DAOException { List<AbstractEntity> lista = new ArrayList<AbstractEntity>(); try {/*from www . j ava 2 s . c om*/ Session session = currentSession(); CursoAbstract res = (CursoAbstract) session.load(CursoImpl.class, new Long(id)); org.hibernate.Hibernate.initialize(res); lista.add(res); } catch (ObjectNotFoundException onfe) { throw new DAOException(onfe); } catch (HibernateException he1) { throw new DAOException(he1); } return lista; }