-->
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.  [ 3 posts ] 
Author Message
 Post subject: Derby: distinct results in error
PostPosted: Mon Apr 07, 2008 10:11 am 
Newbie

Joined: Fri Oct 21, 2005 4:31 am
Posts: 8
Location: Bern / Switzerland
Hi,

there seems to be a problem with hibernate 3.2.6 and derby 10.3.2.1. The derby guys fixed a bug in this release: DERBY-2351

The following query executed fine on previous releases, but now fails with the new derby version:

Code:
Hibernate: select distinct user0_.ID as ID10_, user0_.EMAIL as EMAIL10_, user0_.FIRSTNAME as FIRSTNAME10_, user0_.LASTNAME as LASTNAME10_,  user0_.ROLE as ROLE10_, user0_.USERNAME as USERNAME10_ from XY.XUSER user0_ where user0_.ROLE=? order by user0_.LASTNAME
2008-04-07 15:56:25,937 WARN  [http-8080-2] org.hibernate.util.JDBCExceptionReporter: SQL Error: -1, SQLState: 42879
2008-04-07 15:56:25,937 ERROR [http-8080-2] org.hibernate.util.JDBCExceptionReporter: The ORDER BY clause may not contain column 'LASTNAME', since the query specifies DISTINCT and that column does not appear in the query result.


If I change the order by clause to user0_.LASTNAME10_ it works. Could anybody please confirm that this is now a bug related to hibernate? My knowledge about this is limited, so I wanted to ask first instead of fileing a bug report.

Regards,
Simon


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 4:44 pm 
Newbie

Joined: Fri Oct 21, 2005 4:31 am
Posts: 8
Location: Bern / Switzerland
Ups, I forgot to provide the Hibernate Query ...

Code:
String queryString = "select distinct o from User o where o.role = :role order by o.lastName";
Query query = em.createQuery(queryString);
query.setParameter("role", role);
return query.getResultList();


The same statement without the distinct keyword works fine.

Could a dev please confirm that this is a bug? Thanks for your help.

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 15, 2008 6:59 am 
Newbie

Joined: Fri Oct 21, 2005 4:31 am
Posts: 8
Location: Bern / Switzerland
anybody, please?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.