Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.5
Mapping documents:
None
Code between sessionFactory.openSession() and session.close():
None
Full stack trace of any exception that occurs:
org.hibernate.hql.ast.QuerySyntaxException: Hotel is not mapped [from Hotel]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
Name and version of the database you are using:
INFO [org.hibernate.cfg.SettingsFactory]: JDBC driver: Apache Derby Network Client JDBC Driver, version: 10.2.2.1 - (538595)
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
Not much useful..
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html
Hi,
I am trying to build a HQL Editor. I use a custom classloader to load hibernate jars and user project classes. the following code adds the annotated class to the config.
Class configClass = customClassLoader.loadClass("org.hibernate.cfg.AnnotationConfiguration");
customConfiguration = (AnnotationConfiguration) configClass.newInstance();
clazz = reflectHelper.classForName(annotatedPOJO.getName());
customConfiguration.addAnnotatedClass(clazz);
I am trying to get the equivalent SQL using the following code :
SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) hibernateConfiguration.buildSessionFactory();
HQLQueryPlan queryPlan = sessionFactoryImpl.getQueryPlanCache().getHQLQueryPlan(hqlEditor.getText(), true, Collections.EMPTY_MAP);
I get the exception (above) at this last line.. Could any one help me in finding whats going wrong here ? This case is only annotated POJO class. The case with annotated class with mapping XML works fine.
Thanks,
-Vadiraj.