Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.hql.ast.QuerySyntaxException: INFORMATION_SCHEMA.SYSTEM_ALIASES is not mapped.

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I executed the a hibernate application to test, i got the above exception.

the code is:


cfg filr



pojo:



here in my DB, we don.t have the id column, that's why we are getting the problem? in hibernate we must needed the id attribute, but in our table it doesn't, The error is


How to avoid this problem?
 
Reehan Lalkhanwar
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
H.E.M. (Hibernate Entity Manager) prefixes the schema name of accessed database tables to that of the connecting user. For example, if my database account username is MICKEYMOUSE, and I connect a database and then all tables that I try to access will be accessed as MICKEYMOUSE.*.
So try removing the "INFORMATION_SCHEMA" schema name from the query.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried in that by removing schema too, but I get the same exception

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you connecting using a user that can see this table? Are they in the same schema, or has the table been made available via another mechanism (e.g. synonyms)?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:Are you connecting using a user that can see this table? Are they in the same schema, or has the table been made available via another mechanism (e.g. synonyms)?


I'm using HSQL Database Engine and these tables are already predefined with JBOSS Dev studio. They are in the same schema too.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

They are in the same schema too.

So when you log in to the database using a normal SQL client and the user details hibenrate is using to connect you can see this object?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:

They are in the same schema too.

So when you log in to the database using a normal SQL client and the user details hibenrate is using to connect you can see this object?


Yes, Before I start using hibernate, I used JDBC code to test and I got the results too
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - I'm a bit slow today.

Objects in HQL are case sensitive. You've mapped SystemAliases, not SYSTEM_ALIASES.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:Sorry - I'm a bit slow today.

Objects in HQL are case sensitive. You've mapped SystemAliases, not SYSTEM_ALIASES.


Hey Paul, I got idea and changed to "from SystemAliases"


I didn't find exception but I didn't find the results, in DB there are.
and the query is look like I printed from console.



Here I got a doubt, actually there is no id in the table (SYSTEM_ALIASES), but I put the id tag in the hbm file as it is recommended. Then generally it supposed to throw an SQL error as Im trying to fetch id form the table. why it is not throwing error?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here I got a doubt, actually there is no id in the table (SYSTEM_ALIASES), but I put the id tag in the hbm file as it is recommended.


Not just recommended, its mandatory (unless you are using a composite-id).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic