• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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....
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks this was just what I also faced and its solved! Thanks a lot Jai!
 
eat bricks! HA! And here's another one! And a tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic