title: spring data - query left join with ElementCollection
body: <p>I have a entity ConventionEntity with network object and list of Object activityTypes</p>
  
  <p>I want to search conventions with multiple criteria, i used spring data so i used query for search</p>
  
  <p>With the below query i have this error</p>
  
  <blockquote>
    <p>org.hibernate.QueryException: cannot dereference scalar collection
    element: categoryPerimeter [SELECT c FROM
    com.softilys.entities.ConventionEntity c JOIN c.activityTypes act
    WHERE act.categoryPerimeter = :perimeter AND c.network.networkName IN
    (:networkNames) AND c.title = :title ]</p>
  </blockquote>
  
  <pre><code>@Entity
  public class ConventionEntity implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  private String title;
  
  private Network network;
  
  @ElementCollection
  private Set&lt;ActivityType&gt; activityTypes;
  
  }
  
  public class Network implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      private String networkName;
  }
  
  public class ActivityType implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      private String categoryPerimeter;
  }
  
  
  @Repository
  public interface ConventionRepository extends JpaRepository&lt;ConventionEntity, String&gt; {
  
      @Query("SELECT c FROM ConventionEntity c "
              + "LEFT JOIN c.activityTypes act "
              + "WHERE act.categoryPerimeter = :perimeter "
              + "AND c.network.networkName IN (:networkNames) "
              + "AND c.title = :title ")
      List&lt;ConventionEntity&gt; searchConventions(@Param("title") String title, @Param("perimeter") String perimeter ,
              @Param("networkNames") List&lt;String&gt; networkNames);
  
  }
  </code></pre>