-->
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: New QueryTranslator Breaks SELECT DISTINCT ... ORDER BY
PostPosted: Wed Mar 02, 2005 10:55 am 
Newbie

Joined: Tue Mar 01, 2005 10:37 am
Posts: 17
I'm posting the last trail of my last topic as a new topic that represents the current issue. I hope this isn't against the etiquette here.

The new query translator translates my query differently than the old. This causes a SQL error to be thrown for this query. Here's the query:

<query name="troubletickets.getSolvedCategories">
SELECT DISTINCT t.category
FROM Ticket t
WHERE t.status = 'closed'
ORDER BY t.category.name
</query>

Here's the sql generated by the new QueryTranslator:

select distinct category1_.id as id, category1_.name as name2_, category1_.description as descript3_2_, category1_.disabled as disabled2_, category1_.changed as changed2_, category1_.created as created2_, category1_.changed_usr_id as changed7_2_, category1_.created_usr_id as created8_2_ from troubletickets_faqs faq0_, troubletickets_categories category1_, troubletickets_categories category2_ where (faq0_.trca_id=category1_.id and faq0_.trca_id=category2_.id) order by category2_.name


Here's the sql generated by the ClassicQueryTranslator:

select distinct category1_.id as id, category1_.name as name2_, category1_.description as descript3_2_, category1_.disabled as disabled2_, category1_.changed as changed2_, category1_.created as created2_, category1_.changed_usr_id as changed7_2_, category1_.created_usr_id as created8_2_ from troubletickets_faqs faq0_, troubletickets_categories category1_ where faq0_.trca_id=category1_.id order by category1_.name

The SQL from the ClassicQueryTranslator matches my expectations based on the query. The SQL from the new QueryTranslator causes a SQL error to be thrown saying that fields in the ORDER BY of a SELECT DISTINCT must appear in the select list. Should I file this as a bug in JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 11:46 am 
Newbie

Joined: Tue Mar 01, 2005 10:37 am
Posts: 17
I went ahead and put this in JIRA: http://opensource.atlassian.com/project ... se/HHH-172


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.