From 127283374d3700383f68615b5bbc10264b3aca31 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Mon, 30 Jul 2012 12:58:15 +0800 Subject: [PATCH] HHH-7483 fix test failures caused by quoting table name --- .../org/hibernate/id/MultipleHiLoPerTableGenerator.java | 8 +------- .../src/main/java/org/hibernate/id/SequenceGenerator.java | 7 +------ .../src/main/java/org/hibernate/id/TableGenerator.java | 7 ++----- .../java/org/hibernate/id/enhanced/TableGenerator.java | 6 +----- .../main/java/org/hibernate/ejb/HibernatePersistence.java | 2 +- 5 files changed, 6 insertions(+), 24 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java index 0fb40b3ff4..a556c5ba26 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java @@ -216,14 +216,8 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera String normalizedTableName = tableName; String normalizedSchemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); String normalizedCatalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); - - tableName = org.hibernate.mapping.Table.qualify( - dialect.quote( normalizedCatalogName ), - dialect.quote( normalizedSchemaName ), - dialect.quote( tableName ) - ); - qualifiedTableName = new ObjectName( normalizedCatalogName, normalizedSchemaName, normalizedTableName ); + tableName = qualifiedTableName.toText( dialect ); } else { qualifiedTableName = ObjectName.parse( tableName ); diff --git a/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java index 4f9800a242..a1d080be08 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java @@ -106,12 +106,7 @@ public class SequenceGenerator if ( sequenceName.indexOf( '.' ) < 0 ) { final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); - sequenceName = Table.qualify( - dialect.quote( catalogName ), - dialect.quote( schemaName ), - dialect.quote( sequenceName ) - ); - + sequenceName = new ObjectName( catalogName, schemaName, sequenceName ).toText( dialect ); this.qualifiedSequenceName = new ObjectName( catalogName, schemaName, sequenceName ); } else { diff --git a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java index 37734957ef..18090b17ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java @@ -46,6 +46,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jdbc.AbstractReturningWork; import org.hibernate.mapping.Table; import org.hibernate.metamodel.spi.relational.Database; +import org.hibernate.metamodel.spi.relational.ObjectName; import org.hibernate.type.Type; /** @@ -108,11 +109,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab if ( tableName.indexOf( '.' ) < 0 ) { final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); - tableName = Table.qualify( - dialect.quote( catalogName ), - dialect.quote( schemaName ), - dialect.quote( tableName ) - ); + tableName = new ObjectName(catalogName, schemaName, tableName).toText( dialect ); } else { // if already qualified there is not much we can do in a portable manner so we pass it diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 8e876b040e..63c1582f3c 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -350,11 +350,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab qualifiedTableName = new ObjectName( catalogName, schemaName, name ); - name = Table.qualify( - qualifiedTableName.getCatalog().getText( dialect ), - qualifiedTableName.getSchema().getText( dialect ), - qualifiedTableName.getName().getText( dialect ) - ); + name = qualifiedTableName.toText( dialect ); } else { qualifiedTableName = ObjectName.parse( name ); diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java index ed85119b81..e18e102b4b 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java @@ -37,7 +37,7 @@ import org.hibernate.jpa.internal.util.PersistenceUtilHelper; */ @Deprecated public class HibernatePersistence extends HibernatePersistenceProvider implements PersistenceProvider, AvailableSettings { - private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache(); +// private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache(); // /** // * Get an entity manager factory by its entity manager name, using the specified