title: JPQL/HQL - Is it possible to specify the order, by providing a list of IDs?
body: <p>(Note: I'm using the Play! framework, which uses Hibernate as the JPA implementation.)</p>
  
  <p>I have a list of IDs and I want to get the Items from the database by keeping the order that is used in my ID list.</p>
  
  <p>Let's say my list is: 444,222,333,111</p>
  
  <p>I want the JPQL/HQL to return the Item with id #444 first, then the one with id #222, etc.</p>
  
  <p>I tried something like: </p>
  
  <pre><code>id in (444,222,333,111) order by id=444 DESC, id=222 DESC, id=333 DESC, id=111 DESC
  </code></pre>
  
  <p>But it doesn't seem to work.</p>
  
  <p>Is it possible or will I have to forget the "order by" part and manually re-order the Items once returned?</p>