title: Hibernate HQL : where clause with list
body: <p>I am a little confused with Hibernate.
  My problem is the following:</p>
  
  <p>I have an object in a table on my database, and this object is associated to different comments (stored in another table)</p>
  
  <p>In HQL, I want to select those object in my table, but only if the last comment associated to the object has a particular status (the last comment is the one which has the highest ID). One comment is associated to only one object.</p>
  
  <p><strong>This request works fine</strong>:</p>
  
  <pre><code>    select distinct myObject from org.MyClass myInstance
      join myObject.comments comment
      where comment.status in (:theListOfStatusThatIWant)
  </code></pre>
  
  <p><strong>But</strong> that request doesn't do what I want...</p>
  
  <p>I have tried this one :</p>
  
  <pre><code>     select distinct myObject from org.MyClass myInstance
       join myObject.comments comment
       where comment.status in (:theListOfStatusThatIWant)
       order by comment.id desc
  </code></pre>
  
  <p>But without success... (the request works fine but doesn't do what i want)</p>
  
  <p>Can anybody help me ?</p>