Session.createSQLQuery requires that the returned object be of a persistent class.
is there a way of running an sql so that hibernate populates a regular bean (meaning, unknown to hibernate) with the result set values?
for example, say i have a table foo:
i want to run this:
select count(foo.type), foo.type from foo group by foo.type;
now, i want to use hibernate's mapping power, so that i do something along these lines:
1. create a FooCount class:
public class FooCount {
int count;
int type;
// getters and setters
}
2. use something like Session.createSQLQuery, which returns a collection with instances of FooCount with the right values.
thank you for your help!
ittay
|