I'm using hibernate with jboss for ejb3.
I'm trying to reduce cost of a query by denormalizing tables, so that insteat of two tables: user and property (with relation one to many) I have one table aggr_user which is effectiely a result of "user join propery using (user_id)".
Now, the question is: is it possible to map this denormalized table to hibernate entities, so that I could use hibernate to parse result of native queries to this aggr_user:
Code:
sql = "select * from aggr_user where <condition>"
query = manager.createNativeQuery(sql, ???);
for(Object o : query.getResultList()) {
UserAggrEntity e = (UserAggrEntity) o;
e.getParameters(); // <-- is a list of parameters fetched from result set
}