* limitations under the License.
*/
+import java.io.File;
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.hibernate.boot.spi.MetadataImplementor;
+import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.tool.schema.internal.ExceptionHandlerCollectingImpl;
+import org.hibernate.tool.schema.spi.ExecutionOptions;
import org.hibernate.tool.schema.spi.SchemaManagementTool;
+import org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator;
/**
@Override
- ExceptionHandlerCollectingImpl build(MetadataImplementor metadata)
+ ExceptionHandlerCollectingImpl build(
+ MetadataImplementor metadata,
+ File output
+ )
throws
MojoExecutionException,
MojoFailureException
{
- ServiceRegistry service =
+ ServiceRegistry registry =
metadata.getMetadataBuildingOptions().getServiceRegistry();
- SchemaManagementTool tool = service.getService(SchemaManagementTool.class);
+ SchemaManagementTool tool = registry.getService(SchemaManagementTool.class);
+ ExceptionHandlerCollectingImpl handler =
+ new ExceptionHandlerCollectingImpl();
+
+ ExecutionOptions options =
+ SchemaManagementToolCoordinator.buildExecutionOptions(
+ registry
+ .getService(ConfigurationService.class)
+ .getSettings(),
+ handler
+ );
Map config = options.getConfigurationValues();
- tool.getSchemaMigrator(config).doMigration(metadata, options, target);
+ tool.getSchemaValidator(config).doValidation(metadata, options);
+
+ return handler;
}
}