public static <R extends UpdatableRecord<R>> R updateWithOptimisticLocking(final DataSource dataSource,
                                                                               final R record) {
        LOGGER.debug(() -> "Updating a " + record.getTable() + " record:\n" + record);
        try (final Connection connection = dataSource.getConnection()) {
            try {
                checkDataSource(dataSource);
                final DSLContext context = createContextWithOptimisticLocking(connection);
                record.attach(context.configuration());
                record.update();
            } finally {
                releaseDataSource();
            }
        } catch (DataChangedException e) {
            throw new stroom.util.exception.DataChangedException(e.getMessage(), e);
        } catch (final Exception e) {
            throw convertException(e);
        }
        return record;
    }
Tries to insert record into the database. If it doesn't already exist it will insert the
record and return 1. If it already exists then the unique key violation will be swallowed
and will return 0;
<p>
If you need the persisted version of the record from the database then use
{@link JooqUtil#tryCreate(DataSource, UpdatableRecord, TableField, TableField, TableField, Consumer)}
instead.
</p>
stroom-db-util/src/main/java/stroom/db/util/JooqUtil.java