-->
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: UpdateSchema ignores database schema setting
PostPosted: Thu Dec 14, 2006 8:30 am 
Newbie

Joined: Wed Feb 08, 2006 5:57 am
Posts: 7
Hi,
I have multiple Schemas in my Database. The default Schema is set in the hibernate configuration:
<property name="hibernate.default_schema">SPATZENEGGER</property>
Creating the session factory works correctly, but if I try to make a Schema Update after this, nothing happens, because it queries the wrong tablespace (with the correct schema).
The problem is in the Configuration class:
The defaultSchema is set "SPATZENEGGER", but the TableMetaData Schema is empty (table.getSchema()=="").
Any Ideas?
bye
Roland
Code:

      String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG );
      String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA );

      ArrayList script = new ArrayList( 50 );

      Iterator iter = getTableMappings();
      while ( iter.hasNext() ) {
         Table table = (Table) iter.next();
         if ( table.isPhysicalTable() ) {

            TableMetadata tableInfo = databaseMetadata.getTableMetadata(
                  table.getName(),
                  table.getSchema(),
                  table.getCatalog()
               );





Hibernate version: 3.1.3

Name and version of the database you are using: Oracle 10G XE

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
Session factory initialisation:

Code:
10:28:57,527 [main] INFO  JDBC3 getGeneratedKeys(): disabled -- at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:152)
10:28:57,527 [main] INFO  Connection release mode: auto -- at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:160)
10:28:57,528 [main] INFO  Default schema: [b]SPATZENEGGER[/b] -- at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:178)
....
10:28:58,143 [main] DEBUG  Insert 0: insert into [b]SPATZENEGGER.ACLEntryImpl[/b] (levelCol, user_ref, class, id) values (?, ?, 'de.mtu.eprotas.application.security.impl.UserEntryImpl', ?) -- at org.hibernate.persister.entity.AbstractEntityPersister.logStaticSQL(AbstractEntityPersister.java:2452)
10:28:58,143 [main] DEBUG  Update 0: update SPATZENEGGER.ACLEntryImpl set levelCol=?, user_ref=? where id=? -- at org.hibernate.persister.entity.AbstractEntityPersister.logStaticSQL(AbstractEntityPersister.java:2453)



And the Schema Update:(NOVAK is the default tablespace in the database)
Code:
12:36:18,283 [main] INFO  table found: [b]NOVAK.ACLENTRYIMPL[/b] -- at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:40)
12:36:18,283 [main] INFO  columns: [class, levelcol, productelementid, user_ref, group_id, id] -- at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:41)
12:36:18,283 [main] INFO  foreign keys: [fkcc9dd068214ef25f, fkcc9dd068a714cb05, fkcc9dd0686d540584] -- at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:43)



Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 1:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
afaik fixed in hibernate 3.2.1+

_________________
Max
Don't forget to rate


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.