Search in sources :

Example 1 with GenerationTargetToScript

use of org.hibernate.tool.schema.internal.exec.GenerationTargetToScript in project hibernate-orm by hibernate.

the class HibernateSchemaManagementTool method buildGenerationTargets.

GenerationTarget[] buildGenerationTargets(TargetDescriptor targetDescriptor, DdlTransactionIsolator ddlTransactionIsolator, Map options) {
    final String scriptDelimiter = ConfigurationHelper.getString(HBM2DDL_DELIMITER, options);
    final GenerationTarget[] targets = new GenerationTarget[targetDescriptor.getTargetTypes().size()];
    int index = 0;
    if (targetDescriptor.getTargetTypes().contains(TargetType.STDOUT)) {
        targets[index] = new GenerationTargetToStdout(scriptDelimiter);
        index++;
    }
    if (targetDescriptor.getTargetTypes().contains(TargetType.SCRIPT)) {
        if (targetDescriptor.getScriptTargetOutput() == null) {
            throw new SchemaManagementException("Writing to script was requested, but no script file was specified");
        }
        targets[index] = new GenerationTargetToScript(targetDescriptor.getScriptTargetOutput(), scriptDelimiter);
        index++;
    }
    if (targetDescriptor.getTargetTypes().contains(TargetType.DATABASE)) {
        targets[index] = new GenerationTargetToDatabase(ddlTransactionIsolator, false);
    }
    return targets;
}
Also used : GenerationTargetToStdout(org.hibernate.tool.schema.internal.exec.GenerationTargetToStdout) SchemaManagementException(org.hibernate.tool.schema.spi.SchemaManagementException) GenerationTarget(org.hibernate.tool.schema.internal.exec.GenerationTarget) GenerationTargetToScript(org.hibernate.tool.schema.internal.exec.GenerationTargetToScript) GenerationTargetToDatabase(org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase)

Example 2 with GenerationTargetToScript

use of org.hibernate.tool.schema.internal.exec.GenerationTargetToScript in project hibernate-orm by hibernate.

the class HibernateSchemaManagementTool method buildGenerationTargets.

GenerationTarget[] buildGenerationTargets(TargetDescriptor targetDescriptor, JdbcContext jdbcContext, Map options, boolean needsAutoCommit) {
    final String scriptDelimiter = ConfigurationHelper.getString(HBM2DDL_DELIMITER, options);
    final GenerationTarget[] targets = new GenerationTarget[targetDescriptor.getTargetTypes().size()];
    int index = 0;
    if (targetDescriptor.getTargetTypes().contains(TargetType.STDOUT)) {
        targets[index] = new GenerationTargetToStdout(scriptDelimiter);
        index++;
    }
    if (targetDescriptor.getTargetTypes().contains(TargetType.SCRIPT)) {
        if (targetDescriptor.getScriptTargetOutput() == null) {
            throw new SchemaManagementException("Writing to script was requested, but no script file was specified");
        }
        targets[index] = new GenerationTargetToScript(targetDescriptor.getScriptTargetOutput(), scriptDelimiter);
        index++;
    }
    if (targetDescriptor.getTargetTypes().contains(TargetType.DATABASE)) {
        targets[index] = new GenerationTargetToDatabase(getDdlTransactionIsolator(jdbcContext), true);
    }
    return targets;
}
Also used : GenerationTargetToStdout(org.hibernate.tool.schema.internal.exec.GenerationTargetToStdout) SchemaManagementException(org.hibernate.tool.schema.spi.SchemaManagementException) GenerationTarget(org.hibernate.tool.schema.internal.exec.GenerationTarget) GenerationTargetToScript(org.hibernate.tool.schema.internal.exec.GenerationTargetToScript) GenerationTargetToDatabase(org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase)

Aggregations

GenerationTarget (org.hibernate.tool.schema.internal.exec.GenerationTarget)2 GenerationTargetToDatabase (org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase)2 GenerationTargetToScript (org.hibernate.tool.schema.internal.exec.GenerationTargetToScript)2 GenerationTargetToStdout (org.hibernate.tool.schema.internal.exec.GenerationTargetToStdout)2 SchemaManagementException (org.hibernate.tool.schema.spi.SchemaManagementException)2