4 Replies Latest reply on Dec 3, 2007 6:00 AM by Pete Muir

    Unexpected behaviour - DataModel & Nested conversations with

    Daniel Dacila Newbie

      I have a problem which just wont solve. Can this be a bug?
      Please help if you can.

      Environment - Tomcat 6 + Seam 2 + Richfaces 3.1.2 (or 3.2.0 - the same behaviour)

      2 beans:
      which has
      private List inDocuments;

      which has
      @In(required = false)
      private Document inDocument;

      @Begin(nested = true)
      public void editInDocument(Document inDocument) {
      this.inDocument = (Document) contaOnlineDatabase.merge( inDocument);
      public void cancel() {

      1st bean used for displaying a table in the page
      .... some columns....
      one of the column contains
      <s:link action="#{inDocumentAction.editInDocument(document)}">
      <h:graphicImage value="../img/edit.png"/>

      the s:link above goes to the edit page which has an edit form and a cancel button in the page
      <a4j:commandButton value="Cancel" action="#{inDocumentAction.cancel}"/>
      - you can put any cancel button/link here

      the pages.xml is like this:
      <page view-id="inSection.xhtml">
      <navigation from-action="#{inDocumentAction.editInDocument(document)}">
      <redirect view-id="addInDocument.xhtml"/>

      <page view-id="addInDocument.xhtml">
      <navigation from-action="#{inDocumentAction.save}">
      <rule if-outcome="successSaveInDocument">
      <redirect view-id="inSection.xhtml"/>

      <navigation from-action="#{inDocumentAction.cancel}">
      <redirect view-id="inSection.xhtml"/>

      So almost exactly like in the Hotel example with one exception - the search (the DataModel) isn't done in a Session bean, but in a Conversation bean.

      What happens.
      I am in the page with the table,
      The table looks nice,
      hit the edit button - the edit form looks ok
      hit cancel - goes back to the page with the table
      now the table contains bad data.
      I tried different versions of code and I get 2 results:
      1 - the data in the table is completely empty - but the number of rows is ok, like the attributes of the entities in the DataModel are all null
      2 - all rows have the same attributes as the one edited, but again the number of rows is ok.
      The bad data is only on the screen, not in the database.
      Even a refresh of the browser (F5) or enter on the address bar wont change anything.

      So it seems that something alters the conversation context... but i can't figure what.
      I have tested with rich:datatable.
      With h:datatable - not realy the same result but at the second click on edit everything crashes - the parameter to editInDocument comes null

      Please heeeelp.