• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HQL Query Problem

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



- This query works fine in sql but in HQL when I use session.createQuery(sqlQuery) , i get error saying unexpected token (

Thanks in Advance!!
 
Sheriff
Posts: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HQL and JPQL are not the same as SQL. They are far more limited, and don't support everything that's supported in SQL. What you have there is one of those things. But you can use a native query combined with result set mappings to achieve the same thing.
 
Master Rancher
Posts: 4663
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely the SQL for this is:

And that should be easily translated to HQL.

I can't see anything in that query that requires a JOIN on two SELECT statements.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic