Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL query problem

 
Dmitry Shekhter
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I've got simple Hibernate query that i can't get to work.
The problem is that I need to be able to specify a schema name in my query, because later I will be joining to a table in a different query.

Below is a snippet of the code containing my query:

Query q = session.createQuery(
"select my_column from myschema.mytable a where a.ID = :id");

When the code runs, i get an error saying net.sf.hibernate.QueryException: undefined alias: myschema
It looks like Hibernate is treating my schema name as an alias.

Am I missing something with the syntax?

Thanks in advance.

D.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic