title: JPA passing parameter as Set
body: <p>i want to pass a parameter in the jpql as set in an update statement. here is the statement:</p>
  
  <pre><code>    Query query = entityManager.createQuery("UPDATE Patient patient SET "
                                             +"patient.surname=:surname, "
                                             +"patient.firstname=:firstname, "
                                             +"patient.homeAddress=:homeAddress, "
                                             +"patient.relatedPersons=:relatedPersons, "
                                             +"patient.hospital=:hospital "
                                             +"WHERE patient.id=:id");
      query.setParameter("surname", updatablePatient.getSurname());
      query.setParameter("firstname", updatablePatient.getFirstname());
      query.setParameter("homeAddress", updatablePatient.getHomeAddress());
      query.setParameter("relatedPersons", updatablePatient.getRelatedPersons());
      query.setParameter("hospital", updatablePatient.getHospital());
      query.setParameter("id", id);
  </code></pre>
  
  <p>but i get the following error:</p>
  
  <pre><code>org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [****] was not matching type [java.util.Set]; nested exception is java.lang.IllegalArgumentException: Parameter value [****] was not matching type [java.util.Set]
  </code></pre>
  
  <p>any help would be really appreciated. </p>
  
  <p>thanks in advance</p>