try {
service.inPropagationRequired(new Callback()
{
public void call(IDBI dbi)
{
Handle h = DBIUtil.getHandle(dbi);
final int count = h.insert("insert into something (id, name) values (7, 'ignored')");
if (count == 1) {
throw new ForceRollback();
}
else {
throw new RuntimeException("!ZABAK");
}
}
});
}
catch (ForceRollback e) {
assertTrue(true);
}
catch (RuntimeException e) {
e.printStackTrace();
fail("unexpected exception");
}
final Handle h = DBI.open(derby);
int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
assertEquals(0, count);
h.close();
}