HHH-11023 : Miscellaneous fixes required to backport

This commit is contained in:
Gail Badner 2017-01-11 00:38:30 -08:00
parent f697d26161
commit 608ab56c6d
8 changed files with 20 additions and 16 deletions

View File

@ -687,7 +687,7 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
@Override @Override
public Iterable<IndexInformation> getIndexes(TableInformation tableInformation) { public Iterable<IndexInformation> getIndexes(TableInformation tableInformation) {
final Map<Identifier, IndexInformationImpl.Builder> builders = new HashMap<>(); final Map<Identifier, IndexInformationImpl.Builder> builders = new HashMap<Identifier, IndexInformationImpl.Builder>();
final QualifiedTableName tableName = tableInformation.getName(); final QualifiedTableName tableName = tableInformation.getName();
final Identifier catalog = tableName.getCatalogName(); final Identifier catalog = tableName.getCatalogName();
final Identifier schema = tableName.getSchemaName(); final Identifier schema = tableName.getSchemaName();
@ -766,7 +766,7 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
@Override @Override
public Iterable<ForeignKeyInformation> getForeignKeys(TableInformation tableInformation) { public Iterable<ForeignKeyInformation> getForeignKeys(TableInformation tableInformation) {
final Map<Identifier, ForeignKeyBuilder> fkBuilders = new HashMap<>(); final Map<Identifier, ForeignKeyBuilder> fkBuilders = new HashMap<Identifier, ForeignKeyBuilder>();
final QualifiedTableName tableName = tableInformation.getName(); final QualifiedTableName tableName = tableInformation.getName();
final Identifier catalog = tableName.getCatalogName(); final Identifier catalog = tableName.getCatalogName();
final Identifier schema = tableName.getSchemaName(); final Identifier schema = tableName.getSchemaName();

View File

@ -37,7 +37,7 @@ public class TableInformationImpl implements TableInformation {
private PrimaryKeyInformation primaryKey; private PrimaryKeyInformation primaryKey;
private Map<Identifier, ForeignKeyInformation> foreignKeys; private Map<Identifier, ForeignKeyInformation> foreignKeys;
private Map<Identifier, IndexInformation> indexes; private Map<Identifier, IndexInformation> indexes;
private Map<Identifier, ColumnInformation> columns = new HashMap<>( ); private Map<Identifier, ColumnInformation> columns = new HashMap<Identifier, ColumnInformation>( );
private boolean wasPrimaryKeyLoaded = false; // to avoid multiple db reads since primary key can be null. private boolean wasPrimaryKeyLoaded = false; // to avoid multiple db reads since primary key can be null.
@ -93,7 +93,7 @@ public class TableInformationImpl implements TableInformation {
protected Map<Identifier, ForeignKeyInformation> foreignKeys() { protected Map<Identifier, ForeignKeyInformation> foreignKeys() {
if ( foreignKeys == null ) { if ( foreignKeys == null ) {
final Map<Identifier, ForeignKeyInformation> fkMap = new HashMap<>(); final Map<Identifier, ForeignKeyInformation> fkMap = new HashMap<Identifier, ForeignKeyInformation>();
final Iterable<ForeignKeyInformation> fks = extractor.getForeignKeys( this ); final Iterable<ForeignKeyInformation> fks = extractor.getForeignKeys( this );
for ( ForeignKeyInformation fk : fks ) { for ( ForeignKeyInformation fk : fks ) {
fkMap.put( fk.getForeignKeyIdentifier(), fk ); fkMap.put( fk.getForeignKeyIdentifier(), fk );
@ -118,7 +118,7 @@ public class TableInformationImpl implements TableInformation {
protected Map<Identifier, IndexInformation> indexes() { protected Map<Identifier, IndexInformation> indexes() {
if ( indexes == null ) { if ( indexes == null ) {
final Map<Identifier, IndexInformation> indexMap = new HashMap<>(); final Map<Identifier, IndexInformation> indexMap = new HashMap<Identifier, IndexInformation>();
final Iterable<IndexInformation> indexes = extractor.getIndexes( this ); final Iterable<IndexInformation> indexes = extractor.getIndexes( this );
for ( IndexInformation index : indexes ) { for ( IndexInformation index : indexes ) {
indexMap.put( index.getIndexIdentifier(), index ); indexMap.put( index.getIndexIdentifier(), index );

View File

@ -17,7 +17,7 @@ import org.hibernate.mapping.Table;
*/ */
public class NameSpaceTablesInformation { public class NameSpaceTablesInformation {
private final IdentifierHelper identifierHelper; private final IdentifierHelper identifierHelper;
private Map<String, TableInformation> tables = new HashMap<>(); private Map<String, TableInformation> tables = new HashMap<String, TableInformation>();
public NameSpaceTablesInformation(IdentifierHelper identifierHelper) { public NameSpaceTablesInformation(IdentifierHelper identifierHelper) {
this.identifierHelper = identifierHelper; this.identifierHelper = identifierHelper;

View File

@ -197,8 +197,8 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
tryToCreateCatalogs = true; tryToCreateCatalogs = true;
} }
} }
final Map<Namespace, NameSpaceTablesInformation> tablesInformation = new HashMap<>(); final Map<Namespace, NameSpaceTablesInformation> tablesInformation = new HashMap<Namespace, NameSpaceTablesInformation>();
Set<Identifier> exportedCatalogs = new HashSet<>(); Set<Identifier> exportedCatalogs = new HashSet<Identifier>();
for ( Namespace namespace : database.getNamespaces() ) { for ( Namespace namespace : database.getNamespaces() ) {
final NameSpaceTablesInformation nameSpaceTablesInformation = performTablesMigration( final NameSpaceTablesInformation nameSpaceTablesInformation = performTablesMigration(
metadata, metadata,

View File

@ -42,9 +42,10 @@ import static org.junit.Assert.assertThat;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ColumnNamesTest { public class ColumnNamesTest {
@Parameterized.Parameters @Parameterized.Parameters
public static Collection<String> parameters() { public static Collection<String[]> parameters() {
return Arrays.asList( return Arrays.asList(
new String[] {JdbcMetadaAccessStrategy.GROUPED.toString(), JdbcMetadaAccessStrategy.INDIVIDUALLY.toString()} new String[] { JdbcMetadaAccessStrategy.GROUPED.toString() },
new String[] { JdbcMetadaAccessStrategy.INDIVIDUALLY.toString()}
); );
} }

View File

@ -58,9 +58,10 @@ import static org.junit.Assert.assertThat;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class SchemaUpdateTest { public class SchemaUpdateTest {
@Parameterized.Parameters @Parameterized.Parameters
public static Collection<String> parameters() { public static Collection<String[]> parameters() {
return Arrays.asList( return Arrays.asList(
new String[] {JdbcMetadaAccessStrategy.GROUPED.toString(), JdbcMetadaAccessStrategy.INDIVIDUALLY.toString()} new String[] { JdbcMetadaAccessStrategy.GROUPED.toString() },
new String[] { JdbcMetadaAccessStrategy.INDIVIDUALLY.toString()}
); );
} }

View File

@ -46,9 +46,10 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class LongVarcharValidationTest implements ExecutionOptions { public class LongVarcharValidationTest implements ExecutionOptions {
@Parameterized.Parameters @Parameterized.Parameters
public static Collection<String> parameters() { public static Collection<String[]> parameters() {
return Arrays.asList( return Arrays.asList(
new String[] {JdbcMetadaAccessStrategy.GROUPED.toString(), JdbcMetadaAccessStrategy.INDIVIDUALLY.toString()} new String[] { JdbcMetadaAccessStrategy.GROUPED.toString() },
new String[] { JdbcMetadaAccessStrategy.INDIVIDUALLY.toString() }
); );
} }

View File

@ -18,6 +18,7 @@ import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Oracle9iDialect; import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.resource.transaction.spi.TransactionStatus;
import org.hibernate.tool.hbm2ddl.SchemaValidator; import org.hibernate.tool.hbm2ddl.SchemaValidator;
import org.hibernate.tool.schema.JdbcMetadaAccessStrategy; import org.hibernate.tool.schema.JdbcMetadaAccessStrategy;
@ -51,7 +52,7 @@ public class SynonymValidationTest extends BaseNonConfigCoreFunctionalTestCase {
s.getTransaction().commit(); s.getTransaction().commit();
} }
catch (Exception e) { catch (Exception e) {
if ( s.getTransaction().isActive() ) { if ( s.getTransaction().getStatus() == TransactionStatus.ACTIVE ) {
s.getTransaction().rollback(); s.getTransaction().rollback();
} }
} }
@ -69,7 +70,7 @@ public class SynonymValidationTest extends BaseNonConfigCoreFunctionalTestCase {
s.getTransaction().commit(); s.getTransaction().commit();
} }
catch (Exception e) { catch (Exception e) {
if ( s.getTransaction().isActive() ) { if ( s.getTransaction().getStatus() == TransactionStatus.ACTIVE ) {
s.getTransaction().rollback(); s.getTransaction().rollback();
} }
} }