why do we have to use @Modifying annotation for queries in Data Jpa : <p>for example I have a method in my CRUD interface which deletes a user from the database:</p>

<pre><code>public interface CrudUserRepository extends JpaRepository&lt;User, Integer&gt; {

    @Transactional
    @Modifying
    @Query("DELETE FROM User u WHERE u.id=:id")
    int delete(@Param("id") int id, @Param("userId") int userId);
}
</code></pre>

<p>This method will work only with the annotation @Modifying. But what is the need for the annotation here? Why cant spring analyze the query and understand that it is a modifying query?</p>
