hibernate/hibernate-orm · error · SchemaManagementException

Halting on error : %s

Error message

Halting on error : %s

What it means

The halt-on-error exception handler for schema tooling: when a DDL statement fails against a target, it is first wrapped in a CommandAcceptanceException (statement + DB error); with halting behavior active (ExceptionHandlerHaltImpl - the default unless hibernate.hbm2ddl.halt_on_error=false), Hibernate rethrows it as SchemaManagementException with 'Halting on error : <original message>'. The root cause is always one specific failing DDL command.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ExceptionHandlerHaltImpl.java:24

import java.util.Locale;

import org.hibernate.tool.schema.spi.CommandAcceptanceException;
import org.hibernate.tool.schema.spi.ExceptionHandler;
import org.hibernate.tool.schema.spi.SchemaManagementException;

/**
 * @author Steve Ebersole
 */
public class ExceptionHandlerHaltImpl implements ExceptionHandler {
	/**
	 * Singleton access
	 */
	public static final ExceptionHandlerHaltImpl INSTANCE = new ExceptionHandlerHaltImpl();

	@Override
	public void handleException(CommandAcceptanceException exception) {
		throw new SchemaManagementException(
				String.format(
						Locale.ROOT,
						"Halting on error : %s",
						exception.getMessage()
				),
				exception
		);
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Read the wrapped exception: the CommandAcceptanceException cause carries the failing SQL and the database's error - fix that specific statement or precondition.
  2. Make re-runs clean: drop-first (SchemaExport.Action.DROP) or use versioned migrations instead of repeating create.
  3. Grant the executing user the required DDL privileges.
  4. If failures are tolerated (e.g. 'already exists' on re-run), set hibernate.hbm2ddl.halt_on_error=false so the tool logs and continues - then review the logged failures.

Example fix

// before: SchemaUpdate halts at the first failing statement
Map<String, Object> settings = new HashMap<>();
settings.put("hibernate.hbm2ddl.halt_on_error", "true");

// after: log failures and continue, then review them deliberately
Map<String, Object> settings = new HashMap<>();
settings.put("hibernate.hbm2ddl.halt_on_error", "false");
Defensive patterns

Strategy: try-catch

Try / catch

try {
    new SchemaUpdate(metadata, registry).execute(EnumSet.of(TargetType.DATABASE), ...);
} catch (SchemaManagementException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Halting on error")) {
        CommandAcceptanceException cmd = (CommandAcceptanceException) e.getCause();
        // cmd.getMessage() carries the failing DDL + DB error; handle known-benign cases (e.g. 'already exists')
    }
    throw e;
}

Prevention

When it happens

Trigger: Any hbm2ddl execution (create/update/drop) where a generated DDL statement fails and halting is enabled: object already exists on re-runs, dialect generating syntax the DB version rejects, insufficient DDL privileges, FK dependencies blocking drops, disk/tablespace issues - the wrapped CommandAcceptanceException message names the exact statement.

Common situations: Running update twice without drop ('already exists'); generated types not supported on older DB versions; CI running create on a non-clean schema; DB user lacking DDL rights; drop order violating FK constraints.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/9319a7c3215a8e8f. Report an issue: GitHub.