hibernate/hibernate-orm · error · HibernateException

Generator does not generate on execution:

Error message

Generator does not generate on execution: 

What it means

Error "Generator does not generate on execution: " thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/id/GenericGeneratorGeneration.java:249

	@Override
	public String determineBulkInsertionIdentifierGenerationSelectFragment(SqlStringGenerationContext context) {
		return delegate instanceof BulkInsertionCapableIdentifierGenerator generator
				? generator.determineBulkInsertionIdentifierGenerationSelectFragment( context )
				: null;
	}

	private BeforeExecutionGenerator beforeExecutionGenerator() {
		if ( delegate instanceof BeforeExecutionGenerator beforeExecutionGenerator ) {
			return beforeExecutionGenerator;
		}
		throw new HibernateException( "Generator does not generate before execution: " + delegate.getClass().getName() );
	}

	private OnExecutionGenerator onExecutionGenerator() {
		if ( delegate instanceof OnExecutionGenerator onExecutionGenerator ) {
			return onExecutionGenerator;
		}
		throw new HibernateException( "Generator does not generate on execution: " + delegate.getClass().getName() );
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a generator that generates on execution (e.g. identity/sequence insert-time generation) for this mapping.

When it happens

Trigger: Thrown when a value generator is invoked at a timing (before/during execution) it does not support.

Common situations: Typical situations: a database-side (on-execution) generator used where an in-memory (before-execution) generator is required, or vice versa.


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