title: using enum list as parameter in HQL query
body: <p>I have an entity called <code>Band</code> with a attribute <code>List&lt;Genres&gt; genres</code>, Genres is a ENUM with the following values: <code>ALTERNATIVE_ROCK("Alternative Rock"), CLASSIC_ROCK("Classic Rock"), HARD_ROCK("Hard Rock"), HEAVY_METAL("Heavy Metal"),PROGRESSIVE_ROCK("Progressive Rock");</code></p>
  
  <p>I'm trying to create a method that returns a <code>List&lt;Band&gt;</code> using an <code>List&lt;Genres&gt;</code> as parameter using HQL, something like:</p>
  
  <pre><code>public List&lt;Band&gt; listBandsPerGenres(List&lt;Genres&gt; genres);
  </code></pre>
  
  <p>But i'm receiving some errors with HQL queries that i'd tried?</p>
  
  <p>Above some hql queries that i've tried...</p>
  
  <pre><code>Query q = getSession().createQuery("SELECT b FROM Band b JOIN FETCH b.genres g WHERE g IN (?)");
          q.setParameter(0, genres);
          return q.list();
  </code></pre>
  
  <p>returns an error saying that an ArrayList cannot be cast to Enum...</p>
  
  <p>or...</p>
  
  <pre><code>"SELECT b FROM Band b JOIN FETCH b.genres g WHERE g.value IN (?)"
  </code></pre>
  
  <p>returns an error like :  dereference scalar collection element ENUM</p>
  
  <p>property genres mapping, entity Band...</p>
  
  <pre><code>    @Basic(optional=false)
      @Enumerated(EnumType.STRING)
      @ElementCollection(targetClass=Genres.class)
      @CollectionTable(name="banda_generos", joinColumns=@JoinColumn(name="id_banda", nullable=false))
      private List&lt;Genres&gt; genres;
  </code></pre>