コード例 #1
0
  @Transactional(rollbackFor = PersonNotFoundException.class)
  @Override
  public Person update(PersonDTO updated) throws PersonNotFoundException {
    LOGGER.debug("Updating person with information: " + updated);

    Person person = personRepository.findOne(updated.getId());

    if (person == null) {
      LOGGER.debug("No person found with id: " + updated.getId());
      throw new PersonNotFoundException();
    }

    person.update(updated.getFirstName(), updated.getLastName());

    return person;
  }