title: Spring Data Repository @Query - Update and return modified entity
body: <p>let's assume we have a Spring Data repository interface with a custom method...</p>
  
  <pre><code>@Modifying
  @Transactional
  @Query("UPDATE MyEntity SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?1")
  void markAsSoftDeleted(long id);
  </code></pre>
  
  <p>This method simply sets the deletedAt field of the entity, ok. Is there any way to allow this method to return an updated version of the <code>MyEntity</code>?</p>
  
  <p>Obviously...</p>
  
  <pre><code>@Modifying
  @Transactional
  @Query("UPDATE MyEntity SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?1")
  MyEntity markAsSoftDeleted(long id);
  </code></pre>
  
  <p>...does not work, since...</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Modifying queries can only use void or int/Integer as return type! </p>
  </blockquote>
  
  <p>Does anyon know another way to easily allow that, except of course the obvious "add a service layer between repository and caller for such things"...</p>