-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Error: <tableName> is not mapped
PostPosted: Thu Apr 05, 2007 7:18 am 
Regular
Regular

Joined: Thu Apr 05, 2007 7:05 am
Posts: 53
Location: Troisdorf, Germany
Hi,

I just started to work with Hibernate and have a Problem. Perhaps you can help me.

I've made a new hibernate.cfg.xml file and a new Console Configuration with the Wizard. Also I used the reverse engineering function, so that I got the DAO-Code, the mappings and the hibernate.cdg.hbx. At least everything worked fine. I have all the mappings in my hibernate.cfg.xml file and all java files exist in my source folder. When I now want to use a HQL Statement like: select value from test where id='1' I get the error message: test is not mapped

I tried every writing from of test I could mention because I read that HQL is case sensitive but it didn't helped.
I use a Oracle Database where a big schema is implemented. I just created a test-table to try the HQL possibilities.

The CREATE statement:

CREATE TABLE test (
id INTEGER NOT NULL ,
value VARCHAR(100) NULL,
PRIMARY KEY(id)
);

My hibernate.cfg.xml file (removed the rest of mappings):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">chemocr</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@bio-ora:1521:chemdb01</property>
<property name="hibernate.connection.username">csr</property>
<property name="hibernate.default_schema">CSR</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<mapping resource="de/fhg/scai/bio/csr/io/database/hibernate/Test.hbm.xml" />
</session-factory>
</hibernate-configuration>

The file Test.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 5, 2007 11:46:09 AM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="de.fhg.scai.bio.csr.io.database.hibernate.Test" table="TEST">
<id name="id" type="big_decimal">
<column name="ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="value" type="string">
<column name="VALUE" length="100" />
</property>
</class>
</hibernate-mapping>

The java File also exists in this package. I don't paste it here because it would become to long.

So perhaps someone may help me.

Greetz Carina

PS: Excuse my bad english but I'm a german student working at my bachelor thesis and my english isn"t trained very well.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 3:22 pm 
Newbie

Joined: Thu Mar 15, 2007 10:11 am
Posts: 19
Location: Dallas
When you are using HQL then your query should be in the form of the classnames and objects, not in the terms of your database tables. So, your query should be changed like select t.value from Test as t where t.id='1'.

Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 9:04 am 
Regular
Regular

Joined: Thu Apr 05, 2007 7:05 am
Posts: 53
Location: Troisdorf, Germany
Sorry that I haven't answered earlier, but your query doesn"t help me any further. The Java-Class has the same name as the Table and also with the whole package name in front, it doesn't work.

But there is one more error that appeard now: When I make a new Configuration with the same settings I get this message "Sessionfactory error: component class not found: <path>.AlgorithmID " at the place where the session factory should be.
I have the table Algorithm but I have no idea what this AlgorithmID should be.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 8:14 am 
Regular
Regular

Joined: Thu Apr 05, 2007 7:05 am
Posts: 53
Location: Troisdorf, Germany
I found out what it was! I had an old version of Hibernate Tools installed on the server and this version didn"t worked with our brand new Oracle version. Damn, I should have checked this before...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 8:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that doesn't make sense ;)

hibernate tools doesn't have a (known to me at least) incompability with any recent oracle version.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 10:53 am 
Regular
Regular

Joined: Thu Apr 05, 2007 7:05 am
Posts: 53
Location: Troisdorf, Germany
I just can say that I had a much older version of Hibernate Tools installed and after I made the update, everything works fine now. I changed nothing else in the way generating the code. But perhaps it was not the update of Hibernate Tools but the update of JBoss which came along with it?!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.