1 2 Previous Next 18 Replies Latest reply on Mar 23, 2012 12:18 PM by dazed Go to original post
      • 15. Re: Can Seam Persistence be used without needing JSF i.e. from a base HttpServlet class?
        lightguard

        Yep, those are in Seam Faces, but really all they're doing is Conversation.begin and Conversation.end()

        • 16. Re: Can Seam Persistence be used without needing JSF i.e. from a base HttpServlet class?
          dazed

          Jason

           

          So, based on your hint, I included "seam-faces" in the project build - two things happened

          1) I got a bunch of exceptions on Enabling around Seam faces components "ClassNotFound" etc - these weren't fatal and App started

          2) then got back to "ContextNotActive" exception.  So I added the the seam faces ConversationBoundaryInterceptor (as used in Seam Booking example) and removed the TransactionInterceptor (as specified in Seam Persistence docs).

           

          Now I have a context, but my Conversations don't appear to persist across multiple requests.  I can perform an em.find() and an em.merge() within a request, but Conversation is "null" Edit: after the on the next request.  Within request, where the Conversation is active I don't manage to get my database changes committed, but I'm suspecting that may be a different issue.  (side question:  Is there anyway to record the commit or rollback action in the logs for debug purposes?  I see a SQL Update).

           

          My feeling here is that: Yes, Seam Faces has the conversation control methods, but it is also handling the cross-request converation semantics.  For my requirement (non-faces), Weld 2 is speced to provide the cross-request support (based on https://issues.jboss.org/browse/CDI-80).  But will it also provide the conversation control methods - @Begin and @End and an Interceptor outside of seam faces or is there a hybrid configuration that is required - and if so, could someone outline this please?

           

          Regards

          Dave

          • 17. Re: Can Seam Persistence be used without needing JSF i.e. from a base HttpServlet class?
            jharting

            David,

             

            @Begin and @End are really just shortcuts so that you do not have to do conversation.begin() in your methods. The conversation control mechanism (@Begin and @End) will either be added to CDI or an extension will be provided (with CDI 1.1 it no longer makes sense to have such extension in the Faces module since it is no longer JSF-specific). In the meantime you can either live with using the Conversation API directly or copy the @Begin, @End and the underlying interceptor from Seam Faces to your application. This should work because I don't think there is anything JSF-specific in the interceptor implementation.

             

            As for the EntityManager issue, I am a bit confused. Did you manage to get the conversations working without persisting anything in the first place? Are you able to e.g. start a conversation by submitting a value in a non-JSF page and propagate the conversation for a certain number of requests? It is necessary to know this in order to isolate if this is a conversation context issue or Seam Persistence issue.

            • 18. Re: Can Seam Persistence be used without needing JSF i.e. from a base HttpServlet class?
              dazed

              Jozef

               

              I'll try out adding the @Begin and @End into my project - perhaps I misunderstood what Jason was indicating. 

               

              Can I ask - for CDI1.1 will the Interceptor part be moving into Weld (as part of the container?) or provided by Seam Persistence (which might make sense if my assumption that the Conversation is only used with this is correct)? 

               

              In order to use the Faces Interceptor I assume I need to include it in my project just for this - note the startup exceptions I got (see previous).  

               

              I'm digging into persistence issue and will isolate a good test case - perhaps expanding the kitchensink example a little (if only to prove to myself).  I initially added your workaround to my own app and it's possibly something I'm doing wrong.  BTW I added the Seam Persistence TransactionInceptor back in (indicated above I'd removed it) which surely it must need!?.   I will repost on this next week.  

               

              Cheers

              Dave

              1 2 Previous Next