account = database.reload(account, true); // ignore cache, get a copy of author from the datastore
Assert.assertEquals(account.getAddresses().size(), 2); // this is fine, author still linked to 2 books
Assert.assertEquals(account.getName(), originalName); // name is restored
int bookCount = 0;
for (Address b : database.browseClass(Address.class)) {
if (b.getStreet().equals("Mulholland drive") || b.getStreet().equals("Via Veneto"))
bookCount++;
}
Assert.assertEquals(bookCount, 2); // this fails, only 1 entry in the datastore :(
} finally {