[richfaces-issues] [JBoss JIRA] (RF-12608) pickList without collectionType results in failure to lazily load

Juraj Húska (JIRA) jira-events at lists.jboss.org
Fri Dec 7 11:13:17 EST 2012


    [ https://issues.jboss.org/browse/RF-12608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740166#comment-12740166 ] 

Juraj Húska commented on RF-12608:
----------------------------------

Hey guys,

I tried to reproduce the issue in [this|https://github.com/jhuska/RF-12608] project.

When accessing http://localhost:8080/RF-12608 I am getting {{LazyInitializationException}} with stacktrace:

{code}
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.richfaces.tests.ClubEntity.members, no session or session was closed
	org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393)
	org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385)
	org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:378)
	org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:112)
	org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:266)
	org.richfaces.component.util.SelectUtils$SelectItemsIterator.createSelectItemsIterator(SelectUtils.java:204)
	org.richfaces.component.util.SelectUtils$SelectItemsIterator.createUISelectItemsIterator(SelectUtils.java:227)
	org.richfaces.component.util.SelectUtils$SelectItemsIterator.createIterator(SelectUtils.java:244)
	org.richfaces.component.util.SelectUtils$SelectItemsIterator.computeNext(SelectUtils.java:168)
	org.richfaces.component.util.SelectUtils$SelectItemsIterator.computeNext(SelectUtils.java:145)
	com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
	com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
	org.richfaces.renderkit.SelectManyHelper.getClientSelectItems(SelectManyHelper.java:243)
	org.richfaces.renderkit.SelectManyRendererBase.getClientSelectItems(SelectManyRendererBase.java:60)
	org.richfaces.renderkit.html.PickListRenderer.encodeEnd(PickListRenderer.java:202)
	javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
	javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
	javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
	com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
	com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
	javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
	javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
	org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:60)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
	org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
{code}

* However, I am not sure whether that is the same exception as reported ?
* When I change [this|https://github.com/jhuska/RF-12608/blob/master/src/main/java/org/richfaces/tests/ClubEntity.java#L23] on Eager it works correctly
* For me the issue is occurring in all RF versions prior to {{4.2.3}} which have support for {{rich:pickList}}.
* That means that it is either not regression or I am getting different exception because of another issue/wrongly set up project.

Ken H., is this the exception you are getting please? If not could you please check the project and tell me where is the difference with your project ?
                
> pickList without collectionType results in failure to lazily load
> -----------------------------------------------------------------
>
>                 Key: RF-12608
>                 URL: https://issues.jboss.org/browse/RF-12608
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.2.3.Final, 4.3.0.M2
>            Reporter: Ken H
>            Assignee: Juraj Húska
>              Labels: regression
>
> Changes to the selectManyHelper class in 4.2.3+ causes a lazy loading exception in hibernate when the backing collection is persistent and is not eagerly loaded.
> The problem seems to be that fetching the collection in SelectManyHelper.getConvertedValue bypasses the PersistentSet getter that would normally issue the lazy load request.
> Defining the collectionType (e.g. java.util.ArrayList) bypasses this issue.
> Ideally this method would detect Hibernate proxy collections and handle them appropriately. However, I realize that may cause a dependency so perhaps it would be enough to document this option and situation in the component reference.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the richfaces-issues mailing list