4 Replies Latest reply on Mar 4, 2010 5:15 PM by getboa

    Injection of hibernate session + ScopeType.PAGE

      Hi,
      if i inject a hibernate session in an action class with the ScopeType.PAGE, when would it would be closed?
      I've got a query method which populates a List and iterates(just for tests) some values  printing in the output... so far so good, these brought values are printed on output properly,  but the goal ain't that but to iterate it on my page, unfortunately an exception is thrown.
      org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:187)
      so it might be due to session closed, right?
      my doubt is, when the session is no longer available?

        • 1. Re: Injection of hibernate session + ScopeType.PAGE
          idyoshin

          try not to inject but receive your entityManager via folowing method


          (EntityManager )Components.getInstance("entityManager", true);


          Kind regards,
          Ilya Dyoshin

          • 2. Re: Injection of hibernate session + ScopeType.PAGE

            Hey Ilyan,
            thanks for your reply, but it's still throwing the same exception...
            any other idea ?
            thanks in advance

            • 3. Re: Injection of hibernate session + ScopeType.PAGE
              idyoshin

              Actually that should solve the problem (in my case that solved).


              does your page-scoped bean is runned inside of the long-running conversation ?


              If not, try simply create conversation for the page. I.e.  simply change your scope to CONVERSATION and don't propagate your conversation - after navigating to other page SEAM should end that temporal page-scoped conversation. Actually in SEAM, as I've understood from the documentation, everything is inside of the CONVERSATION.


              Regards,


              Ilya Dyoshin

              • 4. Re: Injection of hibernate session + ScopeType.PAGE

                actually what i'm doing is, calling a modalPanel where the form is, submit it to my search method and populate a @DataModel which will be shown on a dataTable.
                I changed to Conversation scope, it worked, but the dataScroller didn't, if i do try to click on second page of it, nothing happens; it looks like that this @DataModel is no longer in that Conversation although it worked fine on Session scope...What am i doin' wrong?