This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 155197 - [65cat] Generated CRUD editor does not handle lazily loaded lists
Summary: [65cat] Generated CRUD editor does not handle lazily loaded lists
Status: RESOLVED DUPLICATE of bug 149413
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Matthew Bohm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-11 03:18 UTC by wobster
Modified: 2008-12-11 04:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wobster 2008-12-11 03:18:17 UTC
I have a hibernate-based JPA model that uses lazy loading extensively for 1-to-many relationships (persistent list under
the covers.) It appears that the generated CRUD JSF editor does not handle this since the object becomes detached and it
looks like it must be manually merged into an open hibernate session for the lazy loading to work.

It appears that some have written servlet filters to help such as discussed here:
http://www.mail-archive.com/users@myfaces.apache.org/msg32821.html

Is the generated code from the CRUD generator supposed to handle lazy loaded collections?

Here is one of the stack traces I received during testing:

failed to lazily initialize a collection of role: com.ants.db.beans.Project.studies, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:
com.ants.db.beans.Project.studies, no session or session was closed
        at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
        at org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
        at com.sun.el.parser.AstEmpty.getValue(AstEmpty.java:70)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
        at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer$RenderedChildIterator.update(HtmlBasicRenderer.java:710)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer$RenderedChildIterator.<init>(HtmlBasicRenderer.java:666)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer$RenderedChildIterator.<init>(HtmlBasicRenderer.java:652)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getChildren(HtmlBasicRenderer.java:295)
        at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:115)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
        at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
        at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
        at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
        at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.render(PartialTraversalLifecycle.java:122)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@16c530a) threw exception
Comment 1 wobster 2008-12-11 03:58:34 UTC
Here is a better example of using the servlet filter:
http://www.hibernate.org/43.html
Comment 2 Matthew Bohm 2008-12-11 04:21:59 UTC
This is a known issue (see 149413). If the servlet filter offers an effective workaround that's very good. I think that
would be implemented by the user after the application is generated.

*** This issue has been marked as a duplicate of 149413 ***