Connection conn = Transaction.begin(DnewsletterPeer.DATABASE_NAME);
boolean success = false;
try {
entry.save(conn);
entry.setDnewsletterCode(getRowCode("NL", entry.getDnewsletterId()));
entry.save(conn);
Transaction.commit(conn);
success = true;
} finally {
if (!success) Transaction.safeRollback(conn);