title: hibernate named query with object
body: <p>I put this in my District.hbm.xml file</p>
  
  <pre><code>&lt;sql-query name="getCarsPerDistrict"&gt;
      &lt;return alias="district" class="java.lang.Object"/&gt;
      &lt;![CDATA[SELECT id, name, district_code, count(*) ....]]&gt;
  &lt;/sql-query&gt;
  </code></pre>
  
  <p>In my DaoImpl i want to access it like this:</p>
  
  <pre><code>List&lt;Object[]&gt; objects = (List&lt;Object[]&gt;)session.getNamedQuery("getCarsPerDistrict").list();
  </code></pre>
  
  <p>I need to access it as a List of Objects because otherwise i dont know how to handle the count(<em>) field in my District Object. Or is it somehow possible to map the count(</em>) to a variable in java?
  I get this error msg: <code>org.hibernate.MappingException: Unknown entity: java.lang.Object</code></p>
  
  <p>My district class looks like this:</p>
  
  <pre><code>private int id;
  private String name;
  private int district_code;
  @Transient
  private long carsQuantity;
  </code></pre>