-->
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.  [ 1 post ] 
Author Message
 Post subject: Using multiple schemas with MySQL
PostPosted: Thu Nov 22, 2007 10:42 am 
Newbie

Joined: Thu Nov 22, 2007 9:48 am
Posts: 1
Hello,

I use a MySQL 5.0 Database server and hibernate 3.0.5.
I've created 2 schemas (called Databases by MySQL) : "schema_commun" and "client_pca".
And in each schema, several tables, for example : client_pca_statut in the schema client_pca.

The config file for the datasource is :
Code:
<connection-url>jdbc:mysql://localhost:3306/SCHEMA_COMMUN</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>my_user</user-name>

I think it means "application connects to the database server with the user "my_user" and on the default schema "SCHEMA_COMMUN"" But maybe i'm wrong.

And when i launch the application, hibernate throws that Exception :
Table 'schema_commun.client_pca_client_pca_statut' doesn't exist.

It's looking for a table named "client_pca_client_pca_statut" in the schema "schema_commun". But What i want it looks for is a table named "client_pca_statut" in the schema "client_pca".

The beginning of the mapping file is:
Code:
<hibernate-mapping default-cascade="none" auto-import="true" default-lazy="false" schema="CLIENT_PCA">

The beginnnig of the part about the concerned class is:
Code:
<class name="com.client.domain.StatutClient" table="CLIENT_PCA_STATUT">


On the other hand, in command line, once connected with user "my_sql", default schema "SCHEMA_COMMUN", if I type in command-line : SELECT * FROM CLIENT_PCA.client_pca_statut;
I get the rows without problem.

This configuration with several schema was used with an Oracle server and was completly operationnal.

Anybody have an idea on how to configure hibernate for doing what i want ?

Thank you in advance,
Jean


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

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.