1 Reply Latest reply on Apr 14, 2008 12:35 PM by Pete Muir

    How to setup Natural Conversation IDs

    Vladimir Kovalyuk Apprentice

      I'm not sure what does the 'parameter-value' parameter of conversation declaration mean. Reference states:



      parameter-value, defines an EL expression used to evaluate the
      value of the natural business key to use as the conversation id. In this example, the conversation id will be the
      primary key value of the auction instance currently in scope.

      What is not obvious is the time when the parameter is evaluated, so meaning of 'currently in scope' is unclear.


      I assumed that the actual value of conversation id in my example has to be formed from request parameter.


      I tried the following example:


      <ui:repeat value="#{myBean.items}" var="item">
          <s:link value="#{item.name}" view="/browseItem.xhtml" propagation="none">
              <f:param name="code" value="#{item.code}" />
          </s:link>
      </ui:repeat>



      It generates bookmarkable URLs and actually begins conversation.


      browseItem.page.xml:


      <page conversation="cItem">
           <description>Item: #{itemHome.object.code}</description>
           <param name="code" value="#{itemHome.code}" />
      </page>



      pages.xml:


      <conversation name="cItem" parameter-name="code" parameter-value="#{itemHome.code}" />



      ItemHome:


      @Begin(MANUAL) @Create void create() {}


      void setCode(String code) {
          super.setId(Long.parse(code));
      }


      String getCode() { return super.getId(); }


      I found some pitfalls:
      1. known problem - UICommand breaks bookmarkable URLs
      2. second attempt to enter the URL leads to problem of entityManager being closed by some cause.
      3. surrogate conversation propagation works implicitly while natural conversation is propagated only if the target page describes the same conversation id.


      I would appreciate any help to get natural conversation id  started to work in my example without pitfalls mentioned above.


      I have to refuse some technics like managing conversation propagation by UICommand attributes or starting conversation by pages xml descriptors because I have to cope with bunch of entities and re-using code and faceletes become the main thing to do.


      I think Seam-Bay is great application but I can't re-use it as the example of how natural conversation should be set up.

        • 1. Re: How to setup Natural Conversation IDs
          Pete Muir Master

          Vladimir Kovalyuk wrote on Apr 13, 2008 09:40 PM:



          1. known problem - UICommand breaks bookmarkable URLs



          Yes.



          2. second attempt to enter the URL leads to problem of entityManager being closed by some cause.

          ?



          3. surrogate conversation propagation works implicitly while natural conversation is propagated only if the target page describes the same conversation id.

          ?



          I have to refuse some technics like managing conversation propagation by UICommand attributes or starting conversation by pages xml descriptors because I have to cope with bunch of entities and re-using code and faceletes become the main thing to do.

          Natural conversations mean you have to manage your conversations differently, and I'm keen to understand your problems, but I really need you to provide some concrete information ;-)