title: Spring JPA Update and Return the Updated Data
body: <p>How to build a JPA method that could return the updated data when updateing using JPA query?
  I have created something like this.</p>
  
  <pre><code>@Transactional
  @Modifying
  @Query("UPDATE User u SET u.isActive = true"
        + " WHERE u.isActive = false AND u.reactivateTime &lt;= currentTime"
        + " AND u.reactivateTime IS NOT null")
  int reactivateUser(@Param("currentTime") ZonedDateTime currentTime);
  </code></pre>
  
  <p>But, what I want is it is returning list of user. If I directly changed it to something like this</p>
  
  <pre><code>@Transactional
  @Modifying
  @Query("UPDATE User u SET u.isActive = true"
        + " WHERE u.isActive = false AND u.reactivateTime &lt;= currentTime"
        + " AND u.reactivateTime IS NOT null")
  List&lt;User&gt; reactivateUser(@Param("currentTime") ZonedDateTime currentTime);
  </code></pre>
  
  <p>It will become error like this.</p>
  
  <pre><code>IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations
  </code></pre>