0

still got problems with linking my db to hibernate

asked 2009-03-17 11:35:10 +0800

dermaik81 gravatar image dermaik81
60 1

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)




If anyone need more information (content of hibernate.cfg.xml, the *facade.xml or the *.hbm.xml e.g.) i will post it as soon as possible. Thanks a lot for your help again.
Best wishes, Maik

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-03-17 11:49:31 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-03-17 11:50:21 +0800

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.

link publish delete flag offensive edit

answered 2009-03-17 13:04:25 +0800

dermaik81 gravatar image dermaik81
60 1

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

link publish delete flag offensive edit

answered 2009-03-17 13:27:10 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-03-17 13:28:16 +0800

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-03-17 11:35:10 +0800

Seen: 161 times

Last updated: Mar 17 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More