• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in Named Queries (Dual not mapped)

 
Pooja Kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Hibernate 3.0.5.
A named query defined in the hbm is like :

<query name="ResponsePkQuery">
SELECT RESPONSE_PK_SEQ.NEXTVAL FROM DUAL
</query>


When I run the util class, I am getting an error :


*** ERROR: DUAL is not mapped.
- *** ERROR: Invalid path: 'RESPONSE_PK_SEQ.NEXTVAL'
- Error in named query: ResponsePKQuery
org.hibernate.hql.ast.QuerySyntaxError: DUAL is not mapped. [
SELECT RESPONSE_PK_SEQ.NEXTVAL FROM DUAL D
]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at com.jpmchase.pws.util.hibernate.HibernateSessionUtil.initSessionFactory(HibernateSessionUtil.java:49)
at com.jpmchase.pws.util.hibernate.HibernateSessionUtil.getSessionFactory(HibernateSessionUtil.java:40)
at com.jpmchase.pws.se.dao.impl.LogDaoImpl.<init>(LogDaoImpl.java:29)
at com.jpmchase.pws.se.dao.impl.LogDaoImpl.main(LogDaoImpl.java:33)
Caused by:
DUAL is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)


Is the query syntax incorrect?

Thanks,
Pooja
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Pooja Hibernate"

Please click on the My Profile link above and change your display name to match the JavaRanch Naming policy of using your real first and real last names.

Thanks

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure exactly the right answer, but in one of our mappings we have the following



Now, What I notice about this is that the "SQL" is surrounded by "{" braces. I doubt that is the reason, but maybe try puttin gyour query inside the braces.

Mark
 
lali kri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pooja
Did you get it working ? Please let me know coz even am having a same problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic