5 Replies Latest reply on May 7, 2007 10:29 AM by umk

    DataModel: Row is not available

    fabricio.lemos

      I had this DataModel bound to the conversation scope

       @DataModel
       public List<Step> getStepList(){
       return useCase.getSteps();
       }
      


      All worked just fine until I changed the association type from List to Set and updated the code to:

       @DataModel
       public Set<Step> getStepList(){
       return useCase.getSteps();
       }
      


      Now the page does not show a new row if a Step is added to the collection. And the console display
      ERROR [HtmlTableRendererBase] Row is not available. Rowindex = 0

      If I end the conversation and access the page again, the new Step is displayed.

      What can be wrong?

      Seam version: 1.2.1

      thanks in advance,
      Fabricio Lemos


        • 1. Re: DataModel: Row is not available
          shane.bryzak

          I believe a DataModel must be a List. Why did you change it to Set?

          • 2. Re: DataModel: Row is not available
            mrobinson28

            Is the documentation incorrect?

            seam reference docs wrote:

            @DataModel

            Exposes an attribute of type List, Map, Set or Object[] as a JSF DataModel into the scope of the owning component...


            I believe that the standard JSF datatable only supports a limited number of types (not java.util.Set ) which seems to cause problems for one-to-many relationships where the "most natural" type of association is a Set. The hibernate documentation seems to really make a point of this being the most correct mapping where there are not any duplicates but then you can't render it using the stock datatable. The last time I tried it the MyFaces implementation actually "incorrectly" supported the rendering of a Set within a datatable but there were discussions about "fixing" the implementation to not support it.


            Can you show how you add to the Collection? and mabye the .xhtml (assuming Facelets)


            • 3. Re: DataModel: Row is not available
              shane.bryzak

              Can you post some of your code that shows what you're trying to achieve?

              • 4. Re: DataModel: Row is not available
                fabricio.lemos

                I want a page where I can edit the properties of a UseCase entity. At the end of the page I want to display the Step entities that belong to the UseCase.

                This is the page code that I have:

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:s="http://jboss.com/products/seam/taglib">
                <body>
                <ui:composition template="/template.xhtml">
                
                 <ui:define name="title">
                 Editar Caso de Uso
                 </ui:define>
                
                 <ui:define name="body">
                 <h:form>
                 <h:messages />
                 Caso de Uso: <h:inputText value="#{useCase.name}" required="true" />
                 <h:commandButton value="Inserir Passo" action="insertStep" />
                 <h:commandButton value="Atualizar" action="update"
                 rendered="${useCase.id != null}" />
                 <h:commandButton value="Inserir" action="insert"
                 rendered="${useCase.id == null}" />
                
                 <h:dataTable value="#{stepList}" var="stepVar">
                 <h:column>
                 <f:facet name="header">Nome</f:facet>
                 #{stepVar.name}
                 </h:column>
                 <h:column>
                 <f:facet name="header">Editar</f:facet>
                 <h:commandLink value="Editar" action="updateStep" />
                 </h:column>
                 </h:dataTable>
                 </h:form>
                 </ui:define>
                
                </ui:composition>
                </body>
                </html>
                


                The "insertStep" commandButton shows another page where I can insert a Step and then go back to the UseCase page. The problem is that the UseCase page does not show the Step added.

                When Step collection was a List, the application did work OK.

                • 5. Re: DataModel: Row is not available
                  umk

                  For what it's worth, I'm seeing the same behavior with a java.util.Set - doesn't work.

                  As soon as I changed to java.util.List, the dataTable rendered properly...