-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Order of tuple objects in SQL query result (bug?)
PostPosted: Wed Oct 19, 2005 6:33 am 
Newbie

Joined: Tue Oct 11, 2005 11:54 am
Posts: 2
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!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 7:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
at the moment it is scalar first entities second ... put a request for enhancement and lets see

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.