1 Reply Latest reply on Jan 29, 2008 11:02 AM by fromage

    AtDataModel sometimes filled with null entries

    fromage

      Hello,


      I hope this is not a frequently asked question with a known bad practice of doing things.


      We have a page showing the details of entity Library with two tabs. In each tab I have a list of items belonging to the Library entity: the list of Books and the list of Journals.
      The lists are stored in @DataModel, initialised by a @Factory method, and belong in different beans: BookBean and JournalBean.


      We're using a4j for tab switching, editing, saving and removing entries so I'm pretty it may be related.


      The problem is that I start with my Books tab, which shows the list of books, all is fine, the factory is called and the list of shown. I can edit them line by line it's working great.


      If I switch to the Journal tab and add a journal it works too, but if I know switch back to the Book tab I get garbage.


      I've noticed that my @DataModel List still holds the correct number of books (I'm not touching anything book related in the Journal tab), but every entry now appears to be null. Or at least empty. In my ui:repeat, iterating over all book entries, empty book returns true. And the factory is never called a second time since the data model contains a List with a correct number of entries, just empty ones.


      I hope this is clear, and I'm not doing anything wrong. I don't know if this is related to a4j or seam, but I find extremely peculiar that my data model would hold null (or empty) entries depending on some action on another bean.
      Maybe it's all obvious, but not to me :(


      Thanks for any helpful advice nudge in the good direction :)