public Optional<Execution> getExecution(String taskName, String taskInstanceId) {
    final List<Execution> executions =
        jdbcRunner.query(
            "select * from " + tableName + " where task_name = ? and task_instance = ?",
            (PreparedStatement p) -> {
              p.setString(1, taskName);
              p.setString(2, taskInstanceId);
            },
            new ExecutionResultSetMapper(true, false));
    if (executions.size() > 1) {
      throw new TaskInstanceException(
          "Found more than one matching execution for task name/id combination.",
          taskName,
          taskInstanceId);
    }

    return executions.size() == 1 ? ofNullable(executions.get(0)) : Optional.empty();
  }
Instead of doing delete+insert, we allow updating an existing execution will all new fields

@return the execution-time of the new execution
db-scheduler/src/main/java/com/github/kagkarlsson/scheduler/jdbc/JdbcTaskRepository.java