1

I want to use HQL editor to test queries but it doesn't work. The problem is that we use annotations instead of configuration file. Is it possible to use annotations instead of configuration file as mapping informations? For now after I run query in HQL editor I got this exception org.hibernate.hql.ast.QuerySyntaxExcetion: HomeEntity is not mapped [select h from HomeEntity h].

pepuch
  • 6,346
  • 7
  • 51
  • 84
  • How does the session factory gets created? Looks like we have to declare the entity in 'annotatedClasses' attribute of the session factory definition some where in the config file. see answer here http://stackoverflow.com/questions/9756925/why-is-annotatedclasses-needed-if-there-is-entity see the list part. – Zeus Oct 31 '13 at 14:03

1 Answers1

-1

Zeus is correct. I guess you may be in a situation similar to me ... I spent a couple of nights to figure it out ... well, I guess, you are using Hibernate with Spring. Those "annotatedClass" classes are defined under the Spring configuration (such as applicationContext.xml) but not in hibernate.cfg.xml. Once I defined those classes with in hibernate.cfg.xml, I can see all the entities available under "Configuration" in the Hibernate (tools) Configurations panel and I can use them in the HQL editor.

Hope this help!