title: Hibernate named query parameter IN list
body: <p>I have found lots of answers for how to send a list parameter in to a query and check if a value is in that list but I'm trying to do the opposite - pass in the value and check if it's contained in a list in the object.</p>
  
  <p>I have the following code to try to retrieve a Person using their username. </p>
  
  <pre><code>Person person = uniqueResult(namedQuery(Person.FIND_BY_USERNAME)
      .setParameter("username", username).setMaxResults(1));
  </code></pre>
  
  <p>The username is contained in a list in the Person object.</p>
  
  <pre><code>@Column(name = "usernames")
  @Convert(converter = PersonUsernameConvertor.class)
  private List&lt;String&gt; usernames;
  </code></pre>
  
  <p>Is it possible to get the Person with the username parameter in their list with a NamedQuery or do I need something else? Below is what I have so far but it's not working, I'm guessing because the parameter value is on the left of the equation.</p>
  
  <pre><code>@NamedQuery(name = Person.FIND_BY_USERNAME,
      query = "SELECT p from Person p WHERE :username IN p.usernames)
  </code></pre>