by Silver Springs ... >> Mon, 12 Apr 1999 21:29:08 GMT
From: Philip Doggett <dogndrum@globalnet.co.uk>
Date: Sunday, April 11, 1999 2:50 AM
Subject: Using dictionaries
When I create a persistent object that I want to be able to obtain via a number of different dictionaries (MemberKeyDictionary), is it always necessary for me to explicitly add the new object to each of the dictionaries? Is there no way to define a relationship between the object and the dictionary that would accomplish this automatically?
For example, say I want to build a simple World Geography application whose major object is:
CountryClass
Attributes:
CountryName : String(30)
CapitalCity: String(30)
Population : Integer
Because I want to be able to list this data:
- alphabetically by CountryName
- alphabetically by CapitalCity
- by Population and CountryName
I need three different dictionaries.
When I populate the database, I seem to be required to:
beginTransaction;
create countryObj;
// initialise the attributes, then
mkdict1.add(countryObj);
mkdict2.add(countryObj);
mkdict3.add(countryOb);
commitTransaction;
Is there no way to define a relationship that results in countryObj being added to each of the dictionaries as a result of the commitTransaction following the create?
Philip Doggett
dogndrum@globalnet.co.uk