Creating the Client Application

In your client insert the following code:

PersistenceManager pm = new PersistenceManager();

// pm.BuildDatabase(); // Make sure to build the database

Country c1 = new Country();

c1.Name = "Germany";

pm.MakePersistent(c1);

Country c2 = new Country();

c2.Name = "USA";

pm.MakePersistent(c2);

Employee e = new Employee();

e.FirstName = "John";

e.LastName = "Doe";  

Travel t = e.NewTravel();

t.Purpose = "Inhouse-Training";

t.AddCountry(c1);

t.AddCountry(c2);

t = e.NewTravel();

t.Purpose = "TechEd 2006";

t.AddCountry(c1);

Address a = new Address();

a.CountryCode = "USA";

a.Zip = "CA 12345";

a.Street = "10, Wounderway";

a.City="Dreamcity"; < DD> 

e.Address = a; < DD >  

pm.MakePersistent(e);

pm.Save();

Two countries are created, Germany and USA. Please note that the countries are immediately made persistent because they are independent objects. The countries are assigned to the two travels from the last example. The first travel went to Germany and USA, the second to Germany.