@NamedQuery always gives an Exception "unexpected token" no matter what query is
used
-------------------------------------------------------------------------------------
Key: ANN-714
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-714
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Windows XPP SP2, Weblogic Server wlserver_10.0, jdk150_11, Weblogic
Workshop
Reporter: VPC
@Entity
@Table(name="CONTACT")
@NamedQueries({ @NamedQuery(name = "selectall", query = "SELECT * FROM
CONTACT") })
public class Contact {
---usual setter getters----
}
@NamedQuery annotation always throws the following exception at the following line:
SessionFactory sessionFactory = new
AnnotationConfiguration().configure().buildSessionFactory();
The stack trace of the exception is as follows:
<Fri Mar 21 15:14:22 EDT 2008> <Info>
<org.hibernate.tool.hbm2ddl.TableMetadata> <BEA-000000> <table found:
hibernatetutorial.contact
<Fri Mar 21 15:14:22 EDT
2008> <Info> <org.hibernate.tool.hbm2ddl.TableMetadata> <BEA-000000>
<columns: [lastname, firstname, email, id]
<Fri
Mar 21 15:14:22 EDT 2008> <Info> <org.hibernate.tool.hbm2ddl.TableMetadata>
<BEA-000000> <foreign keys: []
<Fri
Mar 21 15:14:22 EDT 2008> <Info> <org.hibernate.tool.hbm2ddl.TableMetadata>
<BEA-000000> <indexes: []
<Fri Mar 21 15:14:22 EDT
2008> <Info> <org.hibernate.tool.hbm2ddl.SchemaUpdate> <BEA-000000>
<schema update complete
<Fri Mar 21 15:14:22 EDT
2008> <Trace> <org.hibernate.connection.DriverManagerConnectionProvider>
<BEA-000000> <returning connection to pool, pool size: 1
<Fri Mar 21 15:14:22 EDT 2008> <Debug>
<org.hibernate.impl.SessionFactoryImpl> <BEA-000000> <Checking 1 named HQL
queries
<Fri Mar 21 15:14:22 EDT 2008> <Debug>
<org.hibernate.impl.SessionFactoryImpl> <BEA-000000> <Checking named query:
selectall
<Fri Mar 21 15:14:22 EDT
2008> <Trace> <org.hibernate.engine.query.QueryPlanCache>
<BEA-000000> <unable to locate HQL query plan in cache; generating (SELECT * FROM
CONTACT)
<Fri Mar 21 15:14:22 EDT
2008> <Debug> <org.hibernate.hql.ast.QueryTranslatorImpl>
<BEA-000000> <parse() - HQL: SELECT * FROM CONTACT
<Fri
Mar 21 15:14:22 EDT 2008> <Error> <org.hibernate.hql.PARSER>
<BEA-000000> <line 1:8: unexpected token: *
<Fri
Mar 21 15:14:22 EDT 2008> <Debug> <org.hibernate.hql.ast.ErrorCounter>
<BEA-000000> <line 1:8: unexpected token: *
org.hibernate.HibernateException: Errors in named queries: selectall
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at hib.FirstExample.main(FirstExample.java:18)
<Fri Mar 21 15:14:22 EDT 2008> <Debug> <org.hibernate.hql.ast.AST>
<BEA-000000> <--- HQL AST ---
\-[QUERY] 'query'
\-[SELECT_FROM] 'SELECT_FROM'
\-[FROM] 'FROM'
\-[RANGE] 'RANGE'
\-[IDENT] 'CONTACT'
<Fri Mar 21 15:14:22 EDT 2008> <Debug>
<org.hibernate.impl.SessionFactoryImpl> <BEA-000000> <Checking 0 named SQL
queries
<Fri Mar 21 15:14:22 EDT 2008> <Error>
<org.hibernate.impl.SessionFactoryImpl> <BEA-000000> <Error in named query:
selectall
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira