-->
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: distinct and order by Problem
PostPosted: Tue Sep 27, 2005 2:36 pm 
Newbie

Joined: Thu Sep 22, 2005 2:55 pm
Posts: 3
Hi All,

I am facing problem when try to execute the following query and I am using Jboss 4.0.
Here is the query..


Code:
public static List getProtocolConditions(long protocolID) {   
String hql = "select distinct ps.conditionType from ConditionsProtocolCondition " +       
" as ps where ps.protocol=:protocolID order by ps.conditionType";   
Session session = HibernateUtil.getCurrentConditionsSession();   
Query q = session.createQuery(hql);   
q.setLong("protocolID", protocolID);   
List protocolCondList = q.list();    return protocolCondList;  }

Here is the error I am getting...
Code:
09:49:05,082 ERROR [LogInterceptor] RuntimeException in method: public abstractcom.exelixis.diesl.to.ConditionsConditionTypeTO[] com.exelixis.diesl.session.remote.ConditionsService.getProtocolConditions(long) throws java.rmi.RemoteException:org.hibernate.exception.GenericJDBCException: could not execute query        at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)        at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)        at org.hibernate.loader.Loader.doList(Loader.java:1564)        at org.hibernate.loader.Loader.list(Loader.java:1544)        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:830)        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)        at com.exelixis.diesl.dao.ConditionsProtocolDAO.getProtocolConditions(ConditionsProtocolDAO.java:147)        at com.exelixis.diesl.session.ConditionsServiceBean.getProtocolConditions(ConditionsServiceBean.java:188)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.        at java.lang.Thread.run(Thread.java:536)Caused by: java.sql.SQLException: ORA-01791: not a SELECTed expression         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)        at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)        at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)        at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)        at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)        at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527)        at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:296)        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)        at org.hibernate.loader.Loader.getResultSet(Loader.java:1237)        at org.hibernate.loader.Loader.doQuery(Loader.java:374)        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)        at org.hibernate.loader.Loader.doList(Loader.java:1561)        ... 69 more09:49:05,192 WARN  [RequestProcessor] Unhandled Exception thrown: class java.rmi.ServerException09:49:05,192 WARN  [[action]] Servlet.service() for servlet action threw exception

The colum which iam using in order by clause is also used in distinct clause, so why I am getting "not a SELECTed expression" error ???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 5:57 pm 
Newbie

Joined: Thu Sep 22, 2005 2:55 pm
Posts: 3
Can Any body suggest the routecasue for my problem..?????


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.