@Transactional
  @Override
  public void updateAndThrowException(Todo updated) {
    LOGGER.info("Updating todo: {}", updated);

    int updatedRowCount =
        jooq.update(TODOS)
            .set(TODOS.DESCRIPTION, updated.getDescription())
            .set(TODOS.TITLE, updated.getTitle())
            .where(TODOS.ID.equal(updated.getId()))
            .execute();

    LOGGER.debug("Updated {} rows.", updatedRowCount);

    LOGGER.info("Todo: {} was updated", updated);

    // This should throw a DataAccessException because the table 'foos' does not exist.
    jooq.select().from("foos").fetch();
  }
  @Transactional
  @Override
  public void update(Todo updated) {
    LOGGER.info("Updating todo: {}", updated);

    int updatedRowCount =
        jooq.update(TODOS)
            .set(TODOS.DESCRIPTION, updated.getDescription())
            .set(TODOS.TITLE, updated.getTitle())
            .where(TODOS.ID.equal(updated.getId()))
            .execute();

    LOGGER.debug("Updated {} rows.", updatedRowCount);

    LOGGER.info("Todo: {} was updated", updated);
  }
  @Transactional(readOnly = true)
  @Override
  public Todo findById(Long id) {
    LOGGER.info("Finding todo by id: {}", id);

    TodosRecord queryResult = jooq.selectFrom(TODOS).where(TODOS.ID.equal(id)).fetchOne();

    LOGGER.debug("Got result: {}", queryResult);

    if (queryResult == null) {
      throw new NotFoundException("No todo found with id: " + id);
    }

    return Todo.getBuilder(queryResult.getTitle())
        .description(queryResult.getDescription())
        .id(queryResult.getId())
        .build();
  }