title: groovy hibernate createSQLQuery access to ResultSetMetaData?
body: <p>I have a simple groovy/grails SQL query where I would like to access the MetaData from the query result, but I am not sure how.</p>
  
  <p>Code sample:</p>
  
  <pre><code>String sqlString = “select * from my_table where id = :myID”
  def queryParams = [ myID: 1 ]
  final sqlQuery = session.createSQLQuery(sqlString)
  final queryResults = sqlQuery.with {
      setProperties( queryParams )
      list()
  }
  
  queryResults.collect { r -&gt;
      r.each{ c -&gt;
          // I extract result data here
      }
  }   
  </code></pre>
  
  <p>I see that </p>
  
  <pre><code>sqlQuery.class == org.hibernate.impl.SQLQueryImpl
  queryResults.class == java.util.ArrayList
  </code></pre>
  
  <p>I saw the following article
  Groovy Goodness: Access ResultSetMetaData with Groovy SQL:
  (<a href="http://mrhaki.blogspot.com/2011/09/groovy-goodness-access.html" rel="nofollow noreferrer">http://mrhaki.blogspot.com/2011/09/groovy-goodness-access.html</a>) but can I get to the ResultSetMetaData using the queryReults code above?</p>
  
  <p>Edit 1: I think I could use AliasToEntityMapResultTransformer
  (<a href="https://stackoverflow.com/questions/22016152/retrieve-a-row-from-db-as-a-map-in-hibernate">Retrieve a row from DB as a Map in Hibernate</a>) if I can figure out how.</p>