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.
|