title: Problem when trying to Join two tables with CriteriaQuery in JPA
body: <p>I am using JPA's Criteria API to implement a search function for my SpringBoot application. For now, at the beginning I am trying to search jobs, which are objects of class JobEntity, which is shown below:</p>
  <pre><code>@Data
  @Entity
  @AllArgsConstructor
  @NoArgsConstructor
  public class JobEntity {
  @Id
  @GeneratedValue(generator = &quot;uuid&quot;)
  private UUID uuid;
  
  @Column(nullable = false)
  private String jobTitle;
  
  @Column(nullable = false)
  private String jobDescription;
  
  @ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
  @Column(nullable = false)
  private List&lt;TechnologyEntity&gt; technology = new ArrayList&lt;&gt;();
  
  @ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.LAZY)
  @Column(nullable = false)
  private List&lt;ProgrammingLanguageEntity&gt; programmingLanguages = new ArrayList&lt;&gt;();
  
  @Enumerated(EnumType.STRING)
  @Column(nullable = false)
  private JobMobilityEnum jobMobility;
  
  @ElementCollection(targetClass= JobTypeEnum.class)
  @Enumerated(EnumType.STRING)
  @Column(nullable = false)
  Collection&lt;JobTypeEnum&gt; jobTypes;
  
  private Integer paymentMin;
  private Integer paymentMax;
  
  @OneToOne(cascade = CascadeType.ALL)
  private JobContactEntity jobContactEntity;
  
  @OneToOne
  private UserEntity createdByUser;
  
  private LocalDate createdAt;
  
  @OneToOne
  private UserEntity updatedByUser;
  
  private LocalDate updatedAt;
  
  @ManyToOne
  private CompanyEntity companyEntity;
  
  @OneToMany
  private List&lt;UserEntity&gt; applicant = new ArrayList&lt;&gt;();
  
  @Enumerated(EnumType.STRING)
  @Column(nullable = false)
  private JobCreatorEnum jobCreator;
  }
  </code></pre>
  <p>I also created an entity for searching of jobs, which contains the criteria by which jobs are searched into the DB:</p>
  <pre><code>@Data
  public class JobSearchEntity {
  private String jobTitle;
  private String jobDescription;
  private List&lt;String&gt; technology;
  private List&lt;String&gt; programmingLanguage;
  private List&lt;String&gt; jobMobility;
  private List&lt;String&gt; jobType;
  private Integer paymentMin;
  private Integer paymentMax;
  }
  </code></pre>
  <p>This object is passed as parameter to the service's method that realizes the search. I noticed that when I try to search for jobs by their basic types (title, description, salary min and max) everything works fine, the data are selected well from the DB and shown at the console.
  However there is a need to filter jobs by their technologies and programming languages, and for that a JOIN with the tables with which Job is in relation must be done. Below is the code for searching by technology name:</p>
  <pre><code>    @Override
      public List&lt;JobEntity&gt; searchJobs() {
      log.info(&quot;JobServiceImpl -&gt; searchJobs&quot;);
      List&lt;JobEntity&gt; foundJobs;
      JobSearchEntity searchCriteria = new JobSearchEntity();
      //cautam un job dupa o parte din descrierea sa
      List&lt;String&gt; techs = new ArrayList(); 
      techs.add(&quot;react&quot;);
      searchCriteria.setTechnology(techs);
      EntityManager entityManager = this.entityManagerFactory.createEntityManager();
      try {
          CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
          CriteriaQuery&lt;JobEntity&gt; criteriaQuery = criteriaBuilder.createQuery(JobEntity.class);
          Root&lt;JobEntity&gt; jobs = criteriaQuery.from(JobEntity.class);
          Join&lt;JobEntity, TechnologyEntity&gt; technologies = jobs.join(&quot;technology&quot;, JoinType.INNER);
          //Join&lt;JobEntity, ProgrammingLanguageEntity&gt; progrLangs = jobs.join(&quot;programmingLanguages&quot;, JoinType.INNER);
          
          // make param list
          List&lt;Predicate&gt; predicates = new ArrayList&lt;&gt;();
          if (searchCriteria.getTechnology() != null &amp;&amp; searchCriteria.getTechnology().size()&gt;0) 
          {
              predicates.add(jobs.get(&quot;technology&quot;).in(searchCriteria.getTechnology()));
          }
  </code></pre>
  <p>However when I run it the following error is thrown by the application:</p>
  <pre><code>&quot;timestamp&quot;: &quot;2022-03-29T07:53:12.855+00:00&quot;,
  &quot;status&quot;: 500,
  &quot;error&quot;: &quot;Internal Server Error&quot;,
  &quot;trace&quot;: &quot;java.lang.IllegalArgumentException: Parameter value [react] did not match expected type [java.util.Collection (n/a)]\r\n\tat org.hibernate.query.spi.QueryParameterBindingValidator.validate(QueryParameterBindingValidator.java:54)\r\n\tat
  </code></pre>
  <p>Does someone is good and tell me what am I doing wrong in that selection by technology code? I'm sending as parameter an object of type ArrayList, which IS of type Collection (since it implements the interface). So why is that error thrown then?</p>