3 Replies Latest reply on Nov 25, 2007 8:02 AM by alexandre russel

    Getting outjected object's attributes

    Ferdo Pis Newbie

      This is a siplified problem of mine. I would like to see, if I am doing anything conceptually wrog.

      This is my object (simplified):

      Hotel
       int nrOfStars;
       @OneToMany
       List<Room> rooms;


      I outject an instance of this object (or I use it in statefull session bean), and I try to show it's attributes in xhtml.

      But I can display hotel's nubmer of stars, but I can not access list of rooms, although they are present (in database). I add rooms with "hotel.getRooms().add(room)".

      I see correct output of
      <h:outputText value="#{hotel.nrOfStars}" />
      , but I can't see proprely
      <h:outputText value="#{fn:length(hotel.rooms)}" />
      (I get always "0").

      How can I access a list of objects in my outjected object? It works if I outject the list itself, but not if i try to access the list "in outjected parent object".
      I hope I've explained the problem properly.

      Ferd0