0 Replies Latest reply on Jan 21, 2006 1:01 PM by Rene Lavoie

    Advice please

    Rene Lavoie Newbie

      Hello,
      I have a small concept app I m building with Seam.
      I m trying to figure out what is the best way to handle a scenario where a number of classes which have a parent/child relationship to each other are also properties of a certain class.

      To illustrate, here is a small example where this scenario may occur.
      Lets say we have a Address class that looks like this:

      @Entity
      class Address {
       private Country country;
       private State state;
       private City city;
      }
      
      @Entity
      class Country {
       private State[] state;
      }
      
      @Entity
      class State {
       private Country country;
       private City[] city;
      }
      
      @Entity
      class City {
       private State state;
      }
      
      

      The idea here is that these classes are all properties of the Address class, yet all these properties have a parent/Child relationship to one another.

      Classes Country/State/City maybe used as:
      - Drop down menus
      - in drill down screens from Country->State->City->AddressList
      - Constraints on on the Address class. (Entering a City that is not part of a certain State).

      I d really like to hear peoples thoughts on this matter, I been trying to identify documentation from various sources to make sure this is a good idea or not, but havent seen this scenario yet, wich gives me doubts about its viability.

      Would it be better to use a Categorize class or something to store association as opposed to having the association on the object in this case?