-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mysql schema name with a . instead of _
PostPosted: Tue Apr 18, 2006 9:49 am 
Beginner
Beginner

Joined: Wed Nov 23, 2005 12:55 pm
Posts: 23
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 ?


Top
 Profile  
 
 Post subject: feature removed
PostPosted: Tue Apr 18, 2006 11:32 am 
Beginner
Beginner

Joined: Wed Nov 23, 2005 12:55 pm
Posts: 23
Could it be this feature is removed?
The test.Product table doesn't exist comes from mysql, I've removed the schema 'test_' from some of my tables and now it seems to work. Is this normal that in the newer version the schema_ features ahs been removed ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.