Hi,
Quote:
Actually we are facing problems while trying to fetch next val from oracle sequence for one of the columns in the table which is not a primary key, but should have some unique value.
Hibernate version: 2.1
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Code:
Query query = getSession().createQuery("SELECT TEST.nextVal FROM DUAL");
List queryResults = query.list();
Full stack trace of any exception that occurs:
net.sf.hibernate.QueryException: undefined alias: TEST [SELECT TEST.nextVal from dual]
at net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:103)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:170)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:295)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1572)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at com.vodafone.wrp.components.catalog.test.TestCriteria.main(TestCriteria.java:66)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: TRACE