|
Hi,
I am getting an Exception 'QuerySyntaxError: users is not mapped. [from users]' in my small application (see full stacktrace below). I tripel checked and the 'users' table and mapping is in place, I actually use it already for inserts and updates, just queries don't work.
Does anybody know what it means?
Here is the code
Session session = SessionManager.currentSession();
Query userQuery = session.createQuery("from users");
List list = userQuery.list();
If I use the following code:
Criteria us = session.createCriteria(User.class);
Iterator it = us.list().iterator();
it works fine.
Also I found in the debug log the following entry:
15:34:46,562 INFO HbmBinder:256 - Mapping class: com.endress.infoserve.wam.bo.impl.User -> users
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: id -> user_oid
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: locale -> locale
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: sites
[b]Hibernate version:[/b]
Hibernate 3.0rc1
[
[b]Full stack trace of any exception that occurs:[/b]
org.hibernate.hql.ast.QuerySyntaxError: users is not mapped. [from users]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:195)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.endress.infoserve.wam.bo.impl.Backend.getUser(Backend.java:48)
at com.endress.infoserve.wam.test.SiteTest.main(SiteTest.java:42)
Caused by: users is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:81)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:71)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:223)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2312)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2232)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:498)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:356)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:184)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:140)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
... 8 more
Exception in thread "main"
[b]Name and version of the database you are using:[/b]
SAPDB 7.5
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]
15:34:46,562 INFO HbmBinder:256 - Mapping class: com.endress.infoserve.wam.bo.impl.User -> users
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: id -> user_oid
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: locale -> locale
15:34:46,562 DEBUG HbmBinder:1086 - Mapped property: sites
|