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.  [ 5 posts ] 
Author Message
 Post subject: Table generated in wrong schema
PostPosted: Sun Oct 30, 2005 12:27 pm 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
Hibernate version: 3.1rc2

I need to have a primary Schema: system1 that has all the app
specific data. Then I need User to be in the security schema.
I set the schema in the hbm file and it is still generated in the system1 schema.
The table generated in the system1 schema is security_user instead of
user in the security schema. How can I make this work the way I want?
Thanks.

Mapping documents:

User.hbm.xml
Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.corp.security">
   <class name="User" table="USER" schema="security">
      <id name="id" column="ID" access="field">
         <generator class="native" />
      </id>

      <property name="firstName" column="FIRST_NAME" length="32" />
   </class>
</hibernate-mapping>


hibernate.cfg.xml
Code:
<?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.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.url">jdbc:mysql://localhost/system1</property>
      <property name="hibernate.connection.username">sys</property>
      <property name="hibernate.connection.password">sys</property>
      <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

      <property name="show_sql">true</property>
      <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
      <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
      <property name="hibernate.hbm2ddl.auto">update</property>

       <mapping resource="com/corp/security/User.hbm.xml"/>
   </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: Check the dialect
PostPosted: Sun Oct 30, 2005 1:35 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
It looks like
Dialect#getSchemaSeparator() returns '_' instead of '.' in your DB dialect.

Look at the Table#qualify method for details

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Is this a bug
PostPosted: Sun Oct 30, 2005 3:19 pm 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
Hey thanks,
I extendded MySQLInnoDBDialect so getSchemaSeparator returned '.' and it works as expected. Is this a bug or will my change cause a bug somewhere else?


Top
 Profile  
 
 Post subject: I think it is bug
PostPosted: Sun Oct 30, 2005 11:16 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I think it is bug.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: I think it is a bug too
PostPosted: Mon Oct 31, 2005 3:41 pm 
Beginner
Beginner

Joined: Wed Apr 06, 2005 9:29 pm
Posts: 24
I understand that this was done to deal with the lack of schemas in MySql way back when,
but MySql has had schemas for a while. Even if we just add a dialect that is setup for the versions of MySql available now.
I put in a bug report on this and it was deleted. Is there something else I can do?


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