title: Fetching sets of objects from GORM
body: <p>I'm working on Grails.
  At some point I have to fetch large sets of objects from the db, based on their ids.
  If I do this id by id, the performance is very bad.</p>
  
  <pre><code>ids.each{
     Myclass.findById( id )
     ...
  }
  </code></pre>
  
  <p>Given that for storing batches there's the useful <strong>withTransaction</strong> closure, is it possible to do something like that to fetch objects, instead of storing them?</p>
  
  <p>Another idea could be a long HQL query like:</p>
  
  <pre><code>"select * from Myclass where (id = 1) OR ( id = 2) ... OR ( id = n )"
  </code></pre>
  
  <p>Is this an ok solution?</p>
  
  <p>Thanks!</p>