title: Making hibernate not include fields from joined tables in select clause
body: <p>I'm running into a performance problem in my SQL using Hibernate's DetachedCriteria. I have a few many-to-one relationships and when Hibernate generates the SQL it's including all of the fields from the tables that are joined in the FROM.
  When this happens, it's taking MySQL a long time to run the query (which also has an order by and sub query adding to the issue). For my currently 50k of records ~6sec. When I remove the unnecessary fields in the SELECT to just the domain object I'm concerned about, it runs well under 500ms.</p>
  
  <p>Is there a way I can tell Hibernate not to include the fields from the joins? </p>
  
  <p>I've tried setting the fetch parameter in the mapping files to 'join' and 'select' and it makes no difference in the generated SQL.</p>
  
  <p>I've also tried setting the distinct root entry, but from what I've read, that doesn't work with paging (which I'm also doing). </p>
  
  <p>I could try and write the query as HQL but with the sub query it just makes it more of a headache.</p>