This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HQL Query Problem  RSS feed

 
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
Posts: 21114
85
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 Foreman
Posts: 2996
37
  • 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
Boost this thread!