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
- Read the wrapped exception: the CommandAcceptanceException cause carries the failing SQL and the database's error - fix that specific statement or precondition.
- Make re-runs clean: drop-first (SchemaExport.Action.DROP) or use versioned migrations instead of repeating create.
- Grant the executing user the required DDL privileges.
- 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
- Make schema steps idempotent: drop-before-create or use versioned migrations instead of repeat create/update
- Run hbm2ddl under a role with exactly the DDL privileges it needs
- Set hibernate.hbm2ddl.halt_on_error=false only when logged failures are reviewed; keep halting in CI
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
- Error performing schema management [persistence unit: {}]
- No create schema syntax supported by " + getClass().getName(
- No drop schema syntax supported by " + getClass().getName()
- Attempt to resolve foreign key metadata from JDBC metadata f
- Attempt to resolve JDBC metadata failed to find columns for
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/9319a7c3215a8e8f.
Report an issue: GitHub.