HHH-7483 fix test failures caused by quoting table name

This commit is contained in:
Strong Liu 2012-07-30 12:58:15 +08:00
parent e4bf3e4583
commit 127283374d
5 changed files with 6 additions and 24 deletions

View File

@ -216,14 +216,8 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera
String normalizedTableName = tableName; String normalizedTableName = tableName;
String normalizedSchemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); String normalizedSchemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
String normalizedCatalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); 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 ); qualifiedTableName = new ObjectName( normalizedCatalogName, normalizedSchemaName, normalizedTableName );
tableName = qualifiedTableName.toText( dialect );
} }
else { else {
qualifiedTableName = ObjectName.parse( tableName ); qualifiedTableName = ObjectName.parse( tableName );

View File

@ -106,12 +106,7 @@ public class SequenceGenerator
if ( sequenceName.indexOf( '.' ) < 0 ) { if ( sequenceName.indexOf( '.' ) < 0 ) {
final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
sequenceName = Table.qualify( sequenceName = new ObjectName( catalogName, schemaName, sequenceName ).toText( dialect );
dialect.quote( catalogName ),
dialect.quote( schemaName ),
dialect.quote( sequenceName )
);
this.qualifiedSequenceName = new ObjectName( catalogName, schemaName, sequenceName ); this.qualifiedSequenceName = new ObjectName( catalogName, schemaName, sequenceName );
} }
else { else {

View File

@ -46,6 +46,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jdbc.AbstractReturningWork; import org.hibernate.jdbc.AbstractReturningWork;
import org.hibernate.mapping.Table; import org.hibernate.mapping.Table;
import org.hibernate.metamodel.spi.relational.Database; import org.hibernate.metamodel.spi.relational.Database;
import org.hibernate.metamodel.spi.relational.ObjectName;
import org.hibernate.type.Type; import org.hibernate.type.Type;
/** /**
@ -108,11 +109,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab
if ( tableName.indexOf( '.' ) < 0 ) { if ( tableName.indexOf( '.' ) < 0 ) {
final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
tableName = Table.qualify( tableName = new ObjectName(catalogName, schemaName, tableName).toText( dialect );
dialect.quote( catalogName ),
dialect.quote( schemaName ),
dialect.quote( tableName )
);
} }
else { else {
// if already qualified there is not much we can do in a portable manner so we pass it // if already qualified there is not much we can do in a portable manner so we pass it

View File

@ -350,11 +350,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab
qualifiedTableName = new ObjectName( catalogName, schemaName, name ); qualifiedTableName = new ObjectName( catalogName, schemaName, name );
name = Table.qualify( name = qualifiedTableName.toText( dialect );
qualifiedTableName.getCatalog().getText( dialect ),
qualifiedTableName.getSchema().getText( dialect ),
qualifiedTableName.getName().getText( dialect )
);
} }
else { else {
qualifiedTableName = ObjectName.parse( name ); qualifiedTableName = ObjectName.parse( name );

View File

@ -37,7 +37,7 @@ import org.hibernate.jpa.internal.util.PersistenceUtilHelper;
*/ */
@Deprecated @Deprecated
public class HibernatePersistence extends HibernatePersistenceProvider implements PersistenceProvider, AvailableSettings { 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 // * Get an entity manager factory by its entity manager name, using the specified