Database db = odmg.newDatabase();
//open database
db.open(databaseName, Database.OPEN_READ_WRITE);
Transaction tx = odmg.newTransaction();
tx.begin();
DBag bag1 = odmg.newDBag();
DBag bag2 = odmg.newDBag();
DListObject a, b, c, d, e;
a = createObject(name);
b = createObject(name);
c = createObject(name);
d = createObject(name);
e = createObject(name);
bag1.add(a);
bag1.add(b);
bag1.add(c);
bag2.add(b);
bag2.add(c);
bag2.add(d);
bag2.add(e);
DBag bag3 = bag1.difference(bag2);
assertEquals("should contain only 1 element", 1, bag3.size());
bag3 = bag1.intersection(bag2);
assertEquals("should contain two elements", 2, bag3.size());
tx.commit();
}