• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL Query Problem

 
Kishen Singh Punjabi
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!!
 
Rob Spoor
Sheriff
Pie
Posts: 20753
68
Chrome Eclipse IDE Java 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.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic