This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped" Watch "HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped" New topic
Author

HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped

Ankur Sharma
Ranch Hand

Joined: Dec 27, 2005
Posts: 1234
Hi I am receiving the above problem. Here are my configuration files.

Exception name is "org.hibernate.hql.ast.QuerySyntaxException: <table name> is not mapped"

person.hbm.xml



Event.hbm.xml


Hibernate Configuration File (hibernate.cfg.xml)



And here is the code I am using to get the data of Person table


And table structure I am using is

Field Type Collation Null Key
---------- ------------ ----------------- ------ ------
PERSON_ID bigint(20) (NULL) NO PRI
age int(11) (NULL) YES
firstname varchar(255) latin1_swedish_ci YES
lastname varchar(255) latin1_swedish_ci YES
BYTE_DATE blob (NULL) YES
EVENT_DATE datetime (NULL) YES
TITLE varchar(255) latin1_swedish_ci YES


Please let me know if you need some more details.
[ May 19, 2008: Message edited by: Ankur Sharma ]

The Best way to predict your future is to create it
Ankur Sharma
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8212
    
  72

List result = session.createQuery("from PERSON").list();


Remember that when you write HQLs, you don't refer to the table or its columns. Instead you use the mapped class and their properties. In your example, you have mapped PERSON table to events.Person, so your HQL should be:


[ May 20, 2008: Message edited by: Jaikiran Pai ]

[My Blog] [JavaRanch Journal]
mohamed yousuf
Greenhorn

Joined: Dec 01, 2008
Posts: 2
Originally posted by Jaikiran Pai:


Remember that when you write HQLs, you don't refer to the table or its columns. Instead you use the mapped class and their properties. In your example, you have mapped PERSON table to events.Person, so your HQL should be:



[ May 20, 2008: Message edited by: Jaikiran Pai ]


thank you jai....im also faced same issue solved now....


Yousuf
bikramjit mandal
Greenhorn

Joined: May 24, 2012
Posts: 1
Thanks this was just what I also faced and its solved! Thanks a lot Jai!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped
 
Similar Threads
Read/Write BLOB in byte[] with Hibernate in MySQL..
Hibernate Maping error
My class is not mapped
using multiple datasources in hibernate app
Not Store data in oracle db