title: Hibenate "Parameter value did not match expected type"
body: <p>I want to insert a <code>List&lt;Completed&gt;</code> objects into a relational table, using Spring framework and Hibernate.</p>
  <p>My entity class has the Collections List field -</p>
  <pre><code>@Entity
  public class User {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long id;
  
      ...
      
      @OneToMany(mappedBy = &quot;user&quot;, cascade = CascadeType.ALL)
      private List&lt;Completed&gt; completedList;
  
      ... // getters/setters
  }
  </code></pre>
  <p>The data access repository -</p>
  <pre><code>public interface UserRepository extends CrudRepository&lt;User, Long&gt; {
  
      Optional&lt;User&gt; findByEmail(String email);
  
      @Modifying
      @Query(value = &quot;update User set completedList = :completed where id = :id&quot;)
      @Transactional
      void addNewCompletion(@Param(&quot;completed&quot;) List&lt;Completed&gt; completed,
                            @Param(&quot;id&quot;) long userID);
  }
  </code></pre>
  <p>I'm calling the method as such (for testing purposes) -</p>
  <pre><code>        Completed completed1 = new Completed(1, LocalDateTime.now());
          Completed completed2 = new Completed(2, LocalDateTime.now());
          Completed completed3 = new Completed(3, LocalDateTime.now());
          List&lt;Completed&gt; completedList = List.of(completed1, completed2, completed3);
  //        completedList.add(completed1);
          UserService.updateUserCompletion(completedList, UserService.findUserID(currentUser));
  </code></pre>
  <p>I have also tried -</p>
  <pre><code>    List&lt;Completed&gt; completedList = new ArrayList()&lt;&gt;;
      completedList.add(new Completed()); // etc.
  </code></pre>
  <pre><code>   Completed completed = new Completed(1, LocalDateTime.now());
     UserService.updateUserCompletion(completed, UserService.findUserID(currentUser));
  </code></pre>
  <p>Either which way results in the same exception -</p>
  <pre><code>java.lang.IllegalArgumentException: Parameter value [io.github.siaust.web_quiz_app.Model.Completed@2f1eafc2] did not match expected type [java.util.Collection (n/a)]
  </code></pre>
  <p>I can't understand as I am passing a <code>List&lt;Completed&gt;</code> object to the <code>@Param</code> of the custom <code>@Query</code>? Why does the type not match?</p>