Assert.assertEquals(account.getAddresses().size(), 1); // before rollback this is fine because one of the books was removed
database.rollback(); // rollback the transaction
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)) {