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)