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: Native SQL Query, not honoring Column Order
PostPosted: Fri Jul 10, 2009 10:37 am 
Newbie

Joined: Fri Jul 10, 2009 10:03 am
Posts: 2
When running a pure, native SQL Query, I specify the column order explicitly. The SQL query generated by Hibernate is correct:

Code:
select TREE_NAME, Category_Name, Subcategory_Name, UV_INDEX, QVI_2, Total_Reach, Total_Sample_Size, TG_Reach, TG_Sample_Size, Min_UV_Total, Min_UV_TG, Capped_Min_UV_Index, Disc_MinPerPage, Ad_Supported, TREE_ID, TREE_LEVEL, MV_CAT_ID, Visits, Disc_Visits, PageViews, Disc_PageViews, Duration, Disc_Duration, Min_Page_Channel, Min_Page_Index_Channel, MIN_UV_INDEX from tempTable


The problem is that the result should be returned as such:
Quote:
congress.org, News & Information, Special Interest News, 530.0, 706, 0.0010, 171,0.0053, 48, 7.5733, 13.9212, 130, 0.9877, Y, 197835, Brand, 2147483647, 660, 1822260.0, 5134, 1.36306E7, 6451.0, 1.38004E7, 1.0125, 102.507, 183.82

But it is getting returned to my Object[] as:
Quote:
183.82, 13.9212, 0.9877, 2147483647, 0.0053, 0.0010, Brand, 6451.0, 7.5733, 5134, congress.org, 130, 48, 1.0125, Special Interest News, News & Information, 1822260.0, 171, 102.507, 706, 197835, Y, 530.0, 1.36306E7, 660, 1.38004E7


The ordering seems to be completely random. (But it orders it in this broken manner, consistently). I have added a primary key to the table to see if it would help, I have added aliases to the columns and tables to see if that would make a difference but it seems to have no effect. I have tried searching for a resolution to this, but I have found nothing. Any help would be greatly appreciated.

Using: Hibernate 3.2.4, Mysql 5.075, Kubuntu, 9.04


Top
 Profile  
 
 Post subject: Re: Native SQL Query, not honoring Column Order
PostPosted: Sat Jul 11, 2009 3:47 pm 
Newbie

Joined: Fri Jul 10, 2009 10:03 am
Posts: 2
So after further investigation it seems that selecting the columns in reverse (for a smaller set of columns) provides the proper ordering. This has to be a bug, unless it is a documented feature that I am not aware of. Any ideas?


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.