hibernate/hibernate-orm · error · SchemaManagementException
VALIDATE is not valid SchemaManagementTool action for script
Error message
VALIDATE is not valid SchemaManagementTool action for script output
What it means
Thrown by SchemaManagementToolCoordinator.performScriptAction (SchemaManagementToolCoordinator.java:461) when the script-generation action group reaches the VALIDATE case. 'validate' is a meaningful action for the database target (compare mapped model with live schema), but writing a 'validation' to a script file makes no sense, so Hibernate rejects jakarta.persistence.schema-generation.scripts.action=validate with a SchemaManagementException instead of producing garbage output.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/tool/schema/spi/SchemaManagementToolCoordinator.java:462
break;
}
case UPDATE: {
final var migrateDescriptor = buildScriptTargetDescriptor(
configurationValues,
MigrateSettingSelector.INSTANCE,
serviceRegistry,
configurationService
);
tool.getSchemaMigrator( configurationValues ).doMigration(
metadata,
executionOptions,
contributed -> true,
migrateDescriptor
);
break;
}
case VALIDATE: {
throw new SchemaManagementException( "VALIDATE is not valid SchemaManagementTool action for script output" );
}
}
}
private static JpaTargetAndSourceDescriptor buildScriptTargetDescriptor(
Map<?,?> configuration,
SettingSelector settingSelector,
ServiceRegistry serviceRegistry,
ConfigurationService configurationService) {
final Object scriptTargetSetting = settingSelector.getScriptTargetSetting( configuration );
final Object scriptSourceSetting = settingSelector.getScriptSourceSetting( configuration );
final var sourceType = sourceType( configuration, settingSelector, scriptSourceSetting );
final boolean includesScripts = sourceType != SourceType.METADATA;
if ( includesScripts && scriptSourceSetting == null ) {
throw new SchemaManagementException(
"Schema generation configuration indicated to include CREATE scripts, but no script was specified"View on GitHub (pinned to fad1729dce)
Solutions
- Remove jakarta.persistence.schema-generation.scripts.action=validate or set it to none/create/drop as appropriate.
- If you want schema validation, use jakarta.persistence.schema-generation.database.action=validate or hibernate.hbm2ddl.auto=validate instead of the scripts.action key.
- If you intended to export DDL scripts, keep scripts.action=create (or create-only) and configure jakarta.persistence.schema-generation.scripts.create-target.
- Audit property files for templated values applied uniformly to all schema-generation keys.
Example fix
// before <property name="jakarta.persistence.schema-generation.scripts.action" value="validate"/> <property name="jakarta.persistence.schema-generation.scripts.create-target" value="create.sql"/> // after <property name="jakarta.persistence.schema-generation.scripts.action" value="create"/> <property name="jakarta.persistence.schema-generation.scripts.create-target" value="create.sql"/> <property name="jakarta.persistence.schema-generation.database.action" value="validate"/>
Defensive patterns
Strategy: validation
Validate before calling
String scriptsAction = (String) props.get("jakarta.persistence.schema-generation.scripts.action");
if ("validate".equalsIgnoreCase(scriptsAction)) {
throw new IllegalStateException(
"scripts.action=validate is not supported; use database.action=validate");
} Try / catch
try {
emf = Persistence.createEntityManagerFactory("pu", props);
} catch (PersistenceException e) {
if (e.getCause() instanceof SchemaManagementException sme
&& sme.getMessage().contains("VALIDATE is not valid")) {
props.remove("jakarta.persistence.schema-generation.scripts.action");
// retry once with corrected config
emf = Persistence.createEntityManagerFactory("pu", props);
} else throw e;
} Prevention
- Never template the same action value across database.action and scripts.action.
- Document in the project config that validation belongs to database.action only.
When it happens
Trigger: Setting jakarta.persistence.schema-generation.scripts.action=validate (or the deprecated javax.persistence.schema-generation.scripts.action=validate) while any script target is configured. Any other scripts.action value (none, create, drop, drop-and-create, create-only) routes to a valid case; only 'validate' hits the throwing branch.
Common situations: Teams that set both database.action and scripts.action to 'validate' for symmetry in test persistence-unit configs; Spring Boot tests adding jakarta.persistence.schema-generation.scripts.* properties for generated-DDL exports while also enabling validation; property templating loops that assign 'validate' to every schema-generation action key.
Related errors
- Unrecognized JPA schema management action setting: '%s'
- Unrecognized 'hibernate.hbm2ddl.auto' setting: '%s'
- Schema generation configuration indicated to include CREATE
- event name to resolve cannot be null
- Unrecognized 'hibernate.hbm2ddl.jdbc_metadata_extraction_str
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/3cbf4c08d8b19e00.
Report an issue: GitHub.