storeObjects(tx, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
storeObjects(tx, getNewProjects("testResultsAfterTransactionWithClearedCache", 2));
tx.commit();
//###### hack we clear cache of PB ########
PersistenceBroker tmp = PersistenceBrokerFactory.defaultPersistenceBroker();
tmp.clearCache();
tmp.close();
int odmgZoosAfter = getDBObjectCountWithNewPB(ODMGZoo.class);
int projectsAfter = getDBObjectCountWithNewPB(Project.class);
int odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, ODMGZoo.class);
int projectsAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, Project.class);
assertEquals("Wrong number of odmgZoos found", (odmgZoosBefore + 10), odmgZoosAfter);
assertEquals("Wrong number of projects found", (projectsBefore + 5), projectsAfter);
assertEquals("Wrong number of odmgZoos found", (odmgZoosBefore + 10), odmgZoosAfterOQL);
assertEquals("Wrong number of projects found", (projectsBefore + 5), projectsAfterOQL);
//we do twice
odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
projectsBefore = getDBObjectCountWithNewPB(Project.class);
//tx should be reusable
tx.begin();
//store
persistentStoreObjects(database, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
persistentStoreObjects(database, getNewProjects("testResultsAfterTransactionWithClearedCache", 3));
//store more
storeObjects(tx, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
storeObjects(tx, getNewProjects("testResultsAfterTransactionWithClearedCache", 2));
tx.commit();
//###### hack we clear cache of PB ########
tmp = PersistenceBrokerFactory.defaultPersistenceBroker();
tmp.clearCache();
tmp.close();
odmgZoosAfter = getDBObjectCountWithNewPB(ODMGZoo.class);
projectsAfter = getDBObjectCountWithNewPB(Project.class);
odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, ODMGZoo.class);
projectsAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, Project.class);