1 2 3 Previous Next 33 Replies Latest reply on Feb 1, 2013 10:52 AM by blabno Go to original post
      • 30. Re: How to avoid LazyInitializationException in facelets page.
        manuel.gentile

        Any news about this issue.....??



        Thanks in advance

        • 31. Re: How to avoid LazyInitializationException in facelets page.
          lightguard

          Not yet, we'll have to examine this. We're focusing on squashing bugs these next couple of weeks, so hopefully we'll get all of these done. You're welcome to come help us out this Thursday at 22:00 UTC. We'll be in the #seam-dev freenode irc channel.

          • 32. Re: How to avoid LazyInitializationException in facelets page.
            lusaxxx

            I think that the problem is how MenuRenderer.java in JSF restore model collections.

             

            Even you preload lazy collection on beggining in moment of Model update. Original collections are restored in 3 ways(from hint of JSF component, cloned and newInstance()). Problem occured with PersistentSet/List/Map which Hibernate replaced original Set/List/Map. Thouse collections got property initialized which is true in moment usage of lazy colleciton. So even you pre-load lazy before in the moment of Update model JSF create new instance with initialized=false so Hibernate try to lazy load this collection but without session which was closed or not reused and here LlE happens.

             

            Unfotunately i do not have any solution how to solved this wihtout workarounds.

            • 33. Re: How to avoid LazyInitializationException in facelets page.
              blabno

              The solution is simple, set attribute collectionType="java.util.ArrayList"

               

                              <h:selectManyCheckbox value="#{diseaseDetailsView.selectedSymptoms}" converter="#{diseaseDetailsView.symptomConverter}" required="true" collectionType="java.util.ArrayList">
                                  <f:selectItems value="#{diseaseDetailsView.allSymptoms}" var="symptom" itemValue="#{symptom}" itemLabel="#{symptom.name}"/>
                              </h:selectManyCheckbox>

              or

                              <h:selectManyCheckbox value="#{diseaseDetailsView.selectedSymptoms}" converter="#{diseaseDetailsView.symptomConverter}" required="true">
                                  <f:selectItems value="#{diseaseDetailsView.allSymptoms}" var="symptom" itemValue="#{symptom}" itemLabel="#{symptom.name}"/>
                                  <f:attribute name="collectionType" value="java.util.ArrayList"/>                
                              </h:selectManyCheckbox>

               

              http://blog.itcrowd.pl/2013/02/jsf-manytomany-and-lazyinitializationex.html

              1 2 3 Previous Next