-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi Folks,
I still got some problems with my hibernate/mysql linking. Here is the error message from tomcat:
org.hibernate.hql.ast.QuerySyntaxException: Vorlesungen is not mapped [SELECT vl_id FROM Vorlesungen] org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158) org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87) org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70) org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688) org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544) org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281) org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229) org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228) org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160) org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56) org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72) org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
Hi Maik,
the message says all: Vorlesungen is not mapped.
The server doesn't find the mapping file Vorlesungen.hbm.xml that
must correspond to your Vorlesungen Model class (if you use traditional
mapping files instead of annotations)
Or you have misspelling: Does you domain class named 'Vorlesung'
Stephan
PS: Please show us the code for calling this select statement.
Hi Stephan,
First, you're right: I want to map a class as a resource. That failed! But the resource vorlesungen.hbm.xml has not been found by tomcat, yet. Here is my listing:
Data structure
+ src
+ org
+ meinstudibuch
- Vorlesungen.java
- VorlesungenFacade.java
- Vorlesungen.hbm.xml
- hibernate.cfg.xml
What is the correct content of my hibernate.cfg.xml file for the resources? I tried the following possibilities:
<mapping resource="src/org/meinstudibuch/Vorlesungen.hbm.xml"/>
<mapping resource="org/meinstudibuch/Vorlesungen.hbm.xml"/>
<mapping resource="src.org.meinstudibuch.Vorlesungen.hbm.xml"/>
<mapping resource="meinstudibuch.Vorlesungen.hbm.xml"/>
Everytime I got the error message, that the resource can't be found. Whats wrong with my setup?
Do you have some hints for me so that I can finish my first example?
Best wishes and a lot of thanks,
Maik
Hmmm, mine is a little bit others because it's spring-managed.
But your seconds seems ok.
"org/meinstudibuch/Vorlesungen.hbm.xml"
Is there no errormessage by starting tomcat ?????????? than have try with following:
change the hql syntax
String hqlString = "FROM Vorlesungen as vorlesungen"
Stephan
Asked: 2009-03-17 11:35:10 +0800
Seen: 161 times
Last updated: Mar 17 '09