class CardUpdateService implements UpdateService<Card> {

  private final JpaRepository<Card> cardJpaRepository;

  @Override
  public Card doUpdate(Card obj, long id) {<FILL_FUNCTION_BODY>}
}

    float additionalSum = obj.getSum();
    Card cardToUpdate = cardJpaRepository.findById(id);
    int initialVersion = cardToUpdate.getVersion();
    float resultSum = cardToUpdate.getSum() + additionalSum;
    cardToUpdate.setSum(resultSum);
    //Maybe more complex business-logic e.g. HTTP-requests and so on

    if (initialVersion != cardJpaRepository.getEntityVersionById(id)) {
      String exMessage =
          String.format("Entity with id %s were updated in another transaction", id);
      throw new ApplicationException(exMessage);
    }

    cardJpaRepository.update(cardToUpdate);
    return cardToUpdate;
  
<no_super_class>