title: Hibernate SQLQuery, how to get arrays and rows objects?
body: <p>Hibernate 3.6 &amp; postgresql 9.1.
  Using SQLQuery how to get result array data (array of Long - assistants, array of rows of "Text, Long, Timestamp" - accounts)?</p>
  
  <pre><code>    limit = 10000;
      final SQLQuery sqlQuery = getSession().createSQLQuery("SELECT id, name, ts, " +
              " array(SELECT assistant_id FROM user_assistant WHERE p_id=pr.id ORDER BY assistant_id) AS accounts," +
              " array(SELECT row(type,uid,ts) FROM user_account WHERE p_id=pr.id ORDER BY type) AS accs," +
              " FROM profile pr WHERE ts &gt; ? ORDER BY ts LIMIT " + limit);
  </code></pre>
  
  <p>The most of DAO functions written with hibernate Entities &amp; annotations.
  But for a few statistics tasks easier to work with HQL or even SQL.
  As opposed to pure JDBC in hibernateSQL working with arrays is not so intuitive.</p>
  
  <p>JDBC could be a solution, but I haven't found any way to get JDBC Statement from Hibernate Session or Connection.
  ResultTransformer doesn't help also, fails with:</p>
  
  <pre><code>    org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003
  </code></pre>