HHH-10433 - Fix hbm2ddl utils has a problem - release jdbc connection
This commit is contained in:
parent
977c34bb59
commit
d35e29dc29
|
@ -130,7 +130,12 @@ public class SchemaUpdate {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
schemaMigrator.doMigration( metadata, databaseInformation, true, toolTargets );
|
try {
|
||||||
|
schemaMigrator.doMigration( metadata, databaseInformation, true, toolTargets );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
databaseInformation.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<org.hibernate.tool.schema.spi.Target> buildToolTargets(Target target) {
|
private List<org.hibernate.tool.schema.spi.Target> buildToolTargets(Target target) {
|
||||||
|
|
|
@ -86,9 +86,13 @@ public class SchemaValidator {
|
||||||
"Error creating DatabaseInformation for schema validation"
|
"Error creating DatabaseInformation for schema validation"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
serviceRegistry.getService( SchemaManagementTool.class ).getSchemaValidator( cfgService.getSettings() )
|
serviceRegistry.getService( SchemaManagementTool.class ).getSchemaValidator( cfgService.getSettings() )
|
||||||
.doValidation( metadata, databaseInformation );
|
.doValidation( metadata, databaseInformation );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
databaseInformation.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -152,4 +152,9 @@ public class DatabaseInformationImpl implements DatabaseInformation, ExtractionC
|
||||||
|
|
||||||
return sequenceInformationMap.get( sequenceName );
|
return sequenceInformationMap.get( sequenceName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanup() {
|
||||||
|
extractionContext.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ public class ExtractionContextImpl implements ExtractionContext {
|
||||||
return registeredTableAccess;
|
return registeredTableAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
if ( jdbcDatabaseMetaData != null ) {
|
if ( jdbcDatabaseMetaData != null ) {
|
||||||
jdbcDatabaseMetaData = null;
|
jdbcDatabaseMetaData = null;
|
||||||
|
|
|
@ -101,4 +101,6 @@ public interface DatabaseInformation {
|
||||||
* @return {@code true} indicates a catalog with the given name already exists
|
* @return {@code true} indicates a catalog with the given name already exists
|
||||||
*/
|
*/
|
||||||
boolean catalogExists(Identifier catalog);
|
boolean catalogExists(Identifier catalog);
|
||||||
|
|
||||||
|
void cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,6 @@ public interface ExtractionContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseObjectAccess getDatabaseObjectAccess();
|
DatabaseObjectAccess getDatabaseObjectAccess();
|
||||||
|
|
||||||
|
void cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue