hibernate/hibernate-orm · error · CompositeValueGenerationException

Generated column values were not provided for composite…

Error message

Generated column values were not provided for composite attribute: {}.{}

What it means

While wiring an OnExecutionGenerator into a composite id attribute, the executor did not supply values for every column of the composite — the generated-values map lacks an entry for some column of the named attribute. The offending input is the incomplete column value detail set.

Solutions

  1. Ensure every generated column of the composite attribute has @Generated or a matching generator so values are produced.
  2. Check the composite attribute mapping so that the set of generated columns matches what the generator provides.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when a composite attribute with generated columns receives no generated values from the database.

Common situations: Typical situations: the driver/database not returning generated values for all columns of the composite; partial generation metadata in the mapping.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/generator/internal/CompositeGeneratorBuilder.java:134

			}
			if ( generator instanceof OnExecutionGenerator onExecutionGenerator
					&& generator.generatedOnExecution() ) {
				final var generatorEventTypes = generator.getEventTypes();
				for ( var eventType : eventTypes ) {
					final var details = columnValueDetailsByEvent.get( eventType );
					if ( details != null ) {
						if ( generatorEventTypes.contains( eventType ) ) {
							if ( !onExecutionGenerator.referenceColumnsInSql( dialect, eventType ) ) {
								details.excludeColumns( columnIndex, span );
							}
							else if ( onExecutionGenerator.writePropertyValue( eventType ) ) {
								// leave the default parameter marker values in place
							}
							else {
								final String[] referencedColumnValues =
										onExecutionGenerator.getReferencedColumnValues( dialect, eventType );
								if ( referencedColumnValues == null ) {
									throw new CompositeValueGenerationException(
											"Generated column values were not provided for composite attribute: "
											+ mappingProperty.getName() + '.' + property.getName()
									);
								}
								if ( referencedColumnValues.length != span ) {
									throw new CompositeValueGenerationException(
											"Mismatch between number of collected generated column values and number of columns for composite attribute: "
											+ mappingProperty.getName() + '.' + property.getName()
									);
								}
								details.setColumnValues( columnIndex, referencedColumnValues );
							}
						}
						else if ( !onExecutionGenerator.allowMutation() ) {
							details.excludeColumns( columnIndex, span );
						}
					}
				}

View on GitHub (pinned to fad1729dce)