This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes HQL query problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL query problem" Watch "HQL query problem" New topic
Author

HQL query problem

Dmitry Shekhter
Greenhorn

Joined: Feb 21, 2001
Posts: 26
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HQL query problem