Try: Hibernate.initialize(hList); On Mar 27, 11:47 am, rwiatr <[email protected]> wrote: > Hello, > I have a problem with RequestFactory and Hibernate session. > [hibernate.LazyInitializationException] - failed to lazily initialize > a collection of role: app.server.dao.HierarchyImpl.children, no > session or session was closed > > @OneToMany(cascade = CascadeType.ALL) > @JoinTable(name = "HIERARCHY_RELATE", joinColumns = > { @JoinColumn(name = "parent_id") }, inverseJoinColumns = > { @JoinColumn(name = "child_id") }) > public Set<HierarchyImpl> getChildren() { > return children; > } > > public static List<HierarchyImpl> rootHierarchyRequest() { > int i = 0; > try { > SessionFactory sessionFactory = > HibernateUtil.getSessionFactory(); > Session session = sessionFactory.openSession(); > List<HierarchyImpl> hList = new > ArrayList<HierarchyImpl>(session > .createQuery("from Hierarchy where > parent is null").list()); > session.close(); > return hList; > } catch (Exception e) { > e.printStackTrace(); > } > return null; > } > Adding FetchType.EAGER helps but in long terms will not solve my > problem. > Is there a good way to manage Hibernate session by RequestFactory?
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
