Example usage for org.hibernate.tool.schema.internal ExceptionHandlerHaltImpl INSTANCE

List of usage examples for org.hibernate.tool.schema.internal ExceptionHandlerHaltImpl INSTANCE

Introduction

In this page you can find the example usage for org.hibernate.tool.schema.internal ExceptionHandlerHaltImpl INSTANCE.

Prototype

ExceptionHandlerHaltImpl INSTANCE

To view the source code for org.hibernate.tool.schema.internal ExceptionHandlerHaltImpl INSTANCE.

Click Source Link

Document

Singleton access

Usage

From source file:org.teiid.spring.autoconfigure.RedirectionSchemaInitializer.java

License:Apache License

List<String> createScript(Metadata metadata, Dialect d, boolean includeDrops) {
    final JournalingGenerationTarget target = new JournalingGenerationTarget();

    final ExecutionOptions options = new ExecutionOptions() {
        @Override//from  ww  w  .  ja v a2 s .co m
        public boolean shouldManageNamespaces() {
            return false;
        }

        @Override
        public Map getConfigurationValues() {
            return Collections.emptyMap();
        }

        @Override
        public ExceptionHandler getExceptionHandler() {
            return ExceptionHandlerHaltImpl.INSTANCE;
        }
    };
    HibernateSchemaManagementTool tool = new HibernateSchemaManagementTool();
    tool.injectServices((ServiceRegistryImplementor) this.registry);
    SourceDescriptor sd = new SourceDescriptor() {
        @Override
        public SourceType getSourceType() {
            return SourceType.METADATA;
        }

        @Override
        public ScriptSourceInput getScriptSourceInput() {
            return null;
        }
    };
    if (includeDrops) {
        new SchemaDropperImpl(tool).doDrop(metadata, options, d, sd, target);
    }
    new SchemaCreatorImpl(tool).doCreation(metadata, d, options, sd, target);
    return target.commands;
}