[jboss-user] [JBoss Seam] - DataModel entries appearing twice
enrico256
do-not-reply at jboss.com
Wed May 16 11:13:55 EDT 2007
I'm writing simple CRUD application that handles I'm writing simple CRUD application that handles "folders" and associated "items". The list of all folders is displayed on the home page as following:
| <h:dataTable value="#{folders}" var="_folder">
| <h:column>
| <f:facet name="header">Id</f:facet>
| <s:link action="#{folderFinder.selectFolder}" value="#{_folder.id}"/>
| </h:column>
| <h:column>
| <f:facet name="header">Title</f:facet>
| <h:outputText value="#{_folder.title}" />
| </h:column>
| ?
| </h:dataTable>
|
"folders" are managed in a SFSB:
| ?
| @DataModel("folders")
| List<Folder> folders;
|
| @DataModelSelection
| @Out(required=false)
| Folder folder;
|
| @In(create=true) @Out(required=false)
| transient ItemFinder itemFinder;
|
| @Out(required=false)
| List<Item> item;
|
| @Factory("folders")
| public void refresh() {
| folders = em.createQuery("from Folder").getResultList();
| }
|
| @Begin(join=true)
| public String selectFolder() {
| itemFinder.refresh(folder); //init "items" to contain items from this folder
| return "view_folder";
| }
| ?
|
So far so good. My problem starts when I select a folder and display it with its items as every item appears twice in the dataTable! A folder is displayed as following :
| <t:panelTabbedPane ? >
| <t:panelTab label="Folder">
| <h:panelGrid columns="2">
| <h:outputText value="Id"/>
| <h:outputText value="#{folder.id}"/>
| <h:outputText value="#Title"/>
| <h:outputText value="#{folder.title}"/>
| ?
| </h:panelGrid>
| </t:panelTab>
|
| <t:panelTab label="Items">
| <h:dataTable value="#{items}" var="_item" >
| <h:column>
| <f:facet name="header">Item id</f:facet>
| <s:link action="#{itemFinder.selectItem}" value="#{_item.id}"/>
| </h:column>
| <h:column>
| <f:facet name="header">Type</f:facet>
| <h:outputText value="#{_item.type}" />
| </h:column>
| ?
| </h:dataTable>
| </t:panelTab>
| </t:panelTabbedPane>
|
"itemFinder" is a SFSB the manages "items":
| @DataModel("items")
| List<Item> items;
|
| @DataModelSelection
| @Out(required=false)
| Item item;
|
| public void refresh(Folder folder) {
| items = folder.getItems();
| }
|
Needless to say the database contains only one copy of each item.
I?m using Seam 1.2.1, AS 4.0.5, MySQL 5.0 and mysql-connector-3.1.13.
I would appreciate if anybody could point me in the right direction.
Thanks in advance,
Enrico
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046184#4046184
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046184
More information about the jboss-user
mailing list