
*************************************************************************

This piece of code can be used to enter simple starting data for the 
University Example.  This code will first delete the local cache file (i.e., lcl_db)
from your program directory.  It will then activate the TstUniversity datastore 
(Workspace datastore), create data, commit the transaction, and reset the datastore
which saves the information back to a new local cache file.

This code can also be used to populate a relational database by changing the 
datastore that is activated.  It is also not necessary to delete the cache 
or reset the datastore.  These steps are only necessary for the Workspace datastore
because of serialization.

*************************************************************************


/*Comment out next line if using a relational datastore.*/
com.ibm.vap.LocalImagePersistence.LocalImageDataStore.deleteCache();

/*Change datastore if using relational services.*/
com.ibm.vap.TstUniversity.Services.TstUniversityDataStore.singleton().activate();

com.ibm.vap.Transactions.Transaction tx;
com.ibm.vap.TstUniversity.TstDepartment dept;

tx = com.ibm.vap.Transactions.Transaction.begin();	

dept = com.ibm.vap.TstUniversity.TstDepartmentHomeImpl.singleton().create("Math");
dept.setBuilding("068");

int i = 0;
com.ibm.vap.TstUniversity.TstStaff staff;
String newValue;
while (i < 5) {
	newValue = String.valueOf(new Integer(800 + i));
	staff = com.ibm.vap.TstUniversity.TstStaffHomeImpl.singleton().create(newValue);
	staff.setName("Staff" + newValue);
	staff.setDepartment(dept);
	dept.addStaff(staff);
	i++;
}

dept = com.ibm.vap.TstUniversity.TstDepartmentHomeImpl.singleton().create("Physics");
dept.setBuilding("001");

dept = com.ibm.vap.TstUniversity.TstDepartmentHomeImpl.singleton().create("Chemistry");
dept.setBuilding("002");

tx.commit();

/*No need to reset if using a relational datastore.*/
com.ibm.vap.Persistence.DataStore.reset(com.ibm.vap.TstUniversity.Services.TstUniversityDataStore.singleton());
