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