Connection conn = Transaction.begin(DistributorPeer.DATABASE_NAME);
boolean success = false;
try {
entry.save(conn);
entry.setDistributorCode(getRowCode("DI", entry.getDistributorId()));
entry.save(conn);
Transaction.commit(conn);
success = true;
} finally {
if (!success) Transaction.safeRollback(conn);