This content has been marked as final.
Show 5 replies
-
1. Re: DataModel: Row is not available
shane.bryzak Apr 16, 2007 7:56 PM (in response to fabricio.lemos)I believe a DataModel must be a List. Why did you change it to Set?
-
2. Re: DataModel: Row is not available
mrobinson28 Apr 16, 2007 9:33 PM (in response to fabricio.lemos)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 Apr 16, 2007 11:13 PM (in response to fabricio.lemos)Can you post some of your code that shows what you're trying to achieve?
-
4. Re: DataModel: Row is not available
fabricio.lemos Apr 17, 2007 8:00 AM (in response to 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 May 7, 2007 10:29 AM (in response to fabricio.lemos)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...