0 Replies Latest reply on Aug 29, 2005 9:11 PM by Evan Toliopoulos

    Associate object, in Hibernate, via a Map of Sets:   Map<key

    Evan Toliopoulos Newbie

      Hi,

      Does anyone know how to associate, in Hibernate, to two classes via a map of sets:

      SortedMap<key,SortedSet>

      I have serached the forums and read all the Hibernate doco, but could not find such a thing explained.

      To give some context:

      +----------+ has +------+ departs from +---------+
      |DealBundle|----------------| Deal |------------------| Airport |
      +----------+ 1 0..* +------+ 1 1 +---------+
       |1 | 1
       | arrives at |
       +--------------------------+
      


      I have an object, call it a DealBundle, which has a whole lot of Deal objects. The Deal objects are kept in multiple SortedSets which in turn are in a Map keyed by the departure Airport object.


      public class DealBundle {
      
       public long id;
      
       public SortedMap<Airport,SortedSet<Deal>>
       dealsByDepartureAirport;
      }
      
      public class Deal {
      
       public long id;
       public Airport departureAirport;
       public Airport arrivalAirport;
       public float totalPrice;
      }
      
      public class Airport {
      
       public long id;
       public long IATACode;
       public long name;
      }
      


      I will appreciate any and every bit advice here because I am at a loss.

      Cheers,
      Evan