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