Hibernate version:
2.1.6
Mapping documents:
<hibernate-mapping>
<class name="com.wdb.sites.WebSiteImpl" proxy="com.wdb.sites.WebSite" table="websites">
<id name="id">
<generator class="sequence">
<param name="sequence">websites_id_seq</param>
</generator>
</id>
<property name="name" not-null="true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Collection results = session.find("select w from WebSite w");
Full stack trace of any exception that occurs:
Exception in thread "main" net.sf.hibernate.QueryException: in expected: w [select w from WebSite w]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1521)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513)
at com.wdb.main.Main.main(Main.java:24)
Name and version of the database you are using:
postgresql 7.4
The generated SQL (show_sql=true):
none
Debug level Hibernate log excerpt:
2004-09-24 15:22:04,024 SessionImpl - find: select w from WebSite w
2004-09-24 15:22:04,037 QueryTranslator - compiling query
Exception in thread "main" net.sf.hibernate.QueryException: in expected: w [select w from WebSite w]
This works fine if I replace WebSite with WebSiteImpl. However, I was hoping not to use concrete classes in the HQL. Is it possible to use interfaces in HQL?
thanks
|