Hi!
I have something like:
List rl = session.createSQLQuery("select {o.*}, sum(lt.a) as asum, sum(mt.b) as bsum from Order as o, .... etc. ")
.addEntity("o",Order.class)
.addScalar("asum",Hibernate.BIG_DECIMAL)
.addScalar("bsum",Hibernate.BIG_DECIMAL)
.list();
Object[] test = rl.get(0);
How to control the order in which the objects are in the Object[3]-tuples?
Currently I'm getting results in which test[0] and test[1] are BigDecimals and test[2] is the Order. I've tried changing the order of the addEntity- and addScalar-calls as well as the order of items in the select stament, but this didn't have any effect.
Is this a bug? How does Hibernate decide the order in which the items are put in the tuples, if it doesn't use the order suggested in the query?!
Thanks for your help!
|