// 2. Get a list of all Masters
Transaction tx = odmg.newTransaction();
tx.begin();
// 1. Insert some objects into the database, some of them with
// details in DetailFKinPK, some of them in DetailFKnoPK
Master master_1 = populatedMasterFKinPK(tx, 7, timestamp);
Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);
tx.lock(master_1, Transaction.WRITE);
tx.lock(master_2, Transaction.WRITE);
tx.lock(master_3, Transaction.WRITE);
tx.lock(master_4, Transaction.WRITE);
tx.commit();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
query.create("select masters from " + Master.class.getName() + " where masterText like $1");
query.bind("%" + timestamp);
DList allMasters = (DList) query.execute();
// Iterator over all Master objects
Iterator it = allMasters.iterator();
int counter = 0;
while (it.hasNext())
{
++counter;
Master aMaster = (Master) it.next();
Iterator it2 = aMaster.collDetailFKinPK.iterator();
while (it2.hasNext())
database.deletePersistent(it2.next());
it2 = aMaster.collDetailFKnoPK.iterator();
while (it2.hasNext())