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 ???