title: How handle Transactions and API call in same method?
body: <p>How handle Transactions and API call in same method?
  If API takes long time to get the data from external api or waits till ConnectionTimeout, updateItemPrice will hold the db as method is @Transactional(readOnly = false).
  How make method performant so that API call does not create long running Transaction?</p>
  <pre><code>@Service
  @Transactional(readOnly = true)
  public class ItemServiceImpl implements ItemService {
  
      @Autowired
      private ItemExternalClient itemExternalClient;
  
      @Autowired
      private ItemRepository itemRepository;
  
      ... other methods
  
      @Override
      @Transactional(readOnly = false)
      public Item updateItemPrice(int itemId) {
          Item item = itemRepository.getById(itemId);
          
          //API call to external items client
          ExternalItem externalItem = itemExternalClient.getItemById(id);
          item.setPrice(externalItem.getPrice());
          
          return itemRepository.save(item);
      }
  }
  </code></pre>