title: Hibernate Query API and Java 1.5/Generics
body: <p>All APIs in Hibernate are from 1.4 and are thus not using java generics.</p>
  
  <p>So I wonder how "safe" the following is: (preconditions: name column is of datatype String, or atleast compatible to String) </p>
  
  <pre><code>@SuppressWarnings("unchecked")
  public List&lt;String&gt; getAll() {
      Query q = session.createQuery(
          "select name from Customers");
      return q.list();    
  }
  </code></pre>
  
  <p>From the Queryi API (org.hibernate.Query.list()) javadoc. </p>
  
  <p><a href="http://www.hibernate.org/hib_docs/v3/api/" rel="nofollow noreferrer">"Return the query results as a List. If the query contains multiple results pre row, the results are returned in an instance of Object[]. "</a></p>