[JBoss Seam] - DataModel entries appearing twice
by enrico256
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
19 years, 1 month
[JBossCache] - Re: TreeCache and enum
by bstansberry@jboss.com
When you say you just switched on TreeCache, do you mean you just started using a 2nd level cache, or were you using a 2nd level cache before and just changed the provider to TreeCache?
If the former, suggest you ask on the Hibernate forums. Your stack trace shows nothing specific to TreeCache going on; it's all stuff internal to Hibernate and how it creates an entity from the data stored in a 2nd level cache.
Hibernate stores an entity in the cache by breaking down its fields into an Object[] and then storing that array as the value under an Fqn + key. When Hibernate wants to load an entity from the cache, it retrieves the Object[]. TreeCache just sees the value as an Object[] and doesn't care whether one or more of the elements in the array is an enum.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046182#4046182
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046182
19 years, 1 month