3 Replies Latest reply on Oct 4, 2007 6:00 PM by Pete Muir

    Examples for nested data

    Rob Shepherd Newbie

      Dear SEAM users,

      i'm just starting out with SEAM. It's a fairly steep learning curve as this is my first project using any EE concepts.

      I'm looking for a simple example of a CRUD style app which has a nested/hierchial object model. I.e each object has a OneToMany relation with child objects of a different type.

      I'd like an example which shows the simple story of, for example.....

      I make a House, then make a number of Rooms for that House, then make a number of chairs for those Rooms.

      As simple as possible would be great, so if anybody has a reference to such an example I would very much appreciate it.

        • 1. Re: Examples for nested data
          Jacek Zebrowski Newbie

          Well there are two aspects of the problem:
          1. Getting Your actual data organized in an intendend way - this happens in EJB's so you should reserch on Entity relations in EJB3.

          Once you got that you Can fetch your entity with all referenced data - and display it somehow - i'd suggest RichFacs tree for that - see richfaces site for details.

          • 2. Re: Examples for nested data
            Rob Shepherd Newbie

            I understand the basic concepts. Data organisation for this project is trivial.

            Houses->Rooms->Chairs

            "Yacho" wrote:
            You Can fetch your entity with all referenced data - and display it somehow


            No I can't.... hence OP :)

            The actual display tree component is irrelavent at this stage. Take for example my model....

            House class has a
            @OneToMany List<Room> rooms
            in it.

            Room has a
            House house
            parent reference in it.

            hibernate deploys this and generates the tables, with constraints, as i would expect. My first step would be to, for example, show the list of houses with the number of rooms in each. I've seen the boilerplate generated code for displaying normal properties, E.g. #{house.name} but how do i go about displaying house.rooms.size() in JSF/facelet. does any code for this need to go in a session bean? what alterations go in the entity.

            as i said i'm a beginner. a simple as possible please.

            many thanks

            Ro


            • 3. Re: Examples for nested data
              Pete Muir Master

              Assuming you have some factory for house to expose the current house in EL

              #{house.rooms.size}


              should work fine