Recently I have found that version checking ( optimistic lock) and version updating do not happen when we use JPQL ( @Query and @Modifying). Hence, I modified the SQL using<