At the moment we have an Oracle db with our schema inside. Now we want to try the application on a mysql table. I've switched the hiberante.cfg.xml to use the mysql db.
<property name="hibernate.c3p0.min_size">15</property>
<property name="hibernate.connection.defaultNChar">true</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">***</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="hibernate.connection.username">***</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
I've got this simple hibernate mapping file:
<hibernate-mapping package="com.test.bo.impl">
<class name="Product" table="PRODUCT" optimistic-lock="none">
<cache usage="read-only" region="com.test.impl.Product"/>
<id name="productId" type="string" unsaved-value="null" column="PRD_ID">
<generator class="assigned"/>
</id>
<property name="productDescription" type="string" column="PRD_DESCRIPTION"/>
</class>
</hibernate-mapping>
But when I run my simple DAOTestCase that issues a Query
Query query = session.createQuery("from Product");
List l = query.list();
I get the following error:
2006-04-18 15:40:47,514 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1146, SQLState: 42S02
2006-04-18 15:40:47,514 ERROR [org.hibernate.util.JDBCExceptionReporter] - Table 'test.product' doesn't exist
Now This worked at first but the same problem occured on another mapping file (joined-class). So I upgraded to the latest hibernate release and now even the first (simple) testcase won't work.
From what I understood from the documentation and the forums, hibernate should perform an automatic transformation for mysql. So test.product should become test_product for mysql.
(I used the reverse enginering tools to create the tables on my mysql database).
I'm kinda a puzzled. I even added the source code to step through it but I haven't got a clue how the internals of hibernate work. Anybody got an idea or can tell me where the select ... from tablename transformation happens ?
|