title: how to return rownum column value with HQL? (using oracle db)
body: <p>I have a complicated HQL query.</p>
  
  <p>I would like to access the Oracle specific <strong>rownum</strong> column value as part of my returned results.  How do I write my query (and/or change my hbm.xml) to support this?</p>
  
  <p>What I have tried so far does not work:</p>
  
  <p>modifying my hbm.xml</p>
  
  <pre><code>&lt;property name="rownum" type="int" update="false" insert="false" generated="never"/&gt;
  </code></pre>
  
  <p>and a query such as:</p>
  
  <pre><code>"select dog.rownum from Dog as dog where ..."
  </code></pre>
  
  <p>But I get <em>java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification</em></p>
  
  <p>I suspect I might need to mix some sql with my complex hql query...  suggestions welcome.  Thanks.</p>
  
  <hr>
  
  <p>Some background:</p>
  
  <ul>
  <li><a href="http://ronfrancis.wordpress.com/2007/10/16/dont-forget-an-order-by-for-pagination-queries/" rel="nofollow noreferrer">http://ronfrancis.wordpress.com/2007/10/16/dont-forget-an-order-by-for-pagination-queries/</a></li>
  <li>hibernate uses oracle's rownum 'under the hood' to paginate results.</li>
  </ul>