views:

442

answers:

1

after did Query query =hibernate.createSQLQuery("select abc,def from table"); Is it possible to auto "parse" the result to "pojo" list?

so that i can do below

List<CustomPOJO> abc = query.list();    //CustomPOJO is pojo not entity , no @Entity tag 
+3  A: 

Try

hibernate.createSQLQuery("select abc,def from table").setResultTransformer(Transformers.aliasToBean(CustomPOJO.class));

like the reference manual suggests.

Tadeusz Kopec