Joined: Sun Sep 21, 2003 11:22 pm Posts: 8 Location: St. Paul, Minnesota
|
I am familiar with mapping and all of that stuff but this piece of HQL is driving me crazy. I made up this quick chunk of code to count the number of events for a given Course.
-- before this I initialize hibSession and it's ok
String hql = "Select count(*) from EVENT where COURSE_ID = :cid";
Query q1 = hibSession.createQuery(hql).setLong("cid",41);
List theList = q1.list();
When I run it I get an exception:
org.hibernate.hql.ast.QuerySyntaxException: EVENT is not mapped. [Select count(*) from EVENT ee where ee.COURSE_ID = :cid]
What type of mapping is the error referring to?
Here also is the debug output
2006-02-26 14:18:34,408 DEBUG AST - --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| +-[FROM] 'from'
| | \-[RANGE] 'RANGE'
| | +-[IDENT] 'EVENT'
| | \-[ALIAS] 'ee'
| \-[SELECT] 'Select'
| \-[COUNT] 'count'
| \-[ROW_STAR] '*'
\-[WHERE] 'where'
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'ee'
| \-[IDENT] 'COURSE_ID'
\-[COLON] ':'
\-[IDENT] 'cid'
Thanks in adv..
|
|