hibernate/hibernate-orm · error · IdentifierGenerationException

Mismatch between generated column values and column count fo

Error message

Mismatch between generated column values and column count for composite id property: ${propertyName}

What it means

Error "Mismatch between generated column values and column count for composite id property: ${propertyName}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorBinder.java:989

					if ( !onExecutionGenerator.referenceColumnsInSql( dialect, EventType.INSERT ) ) {
						for ( int j = 0; j < span; j++ ) {
							columnInclusions[columnIndex + j] = false;
						}
					}
					else if ( onExecutionGenerator.writePropertyValue( EventType.INSERT ) ) {
						// leave default parameter markers in place
					}
					else {
						final String[] referencedColumnValues =
								onExecutionGenerator.getReferencedColumnValues( dialect, EventType.INSERT );
						if ( referencedColumnValues == null ) {
							throw new IdentifierGenerationException(
									"Generated column values were not provided for composite id property: "
											+ property.getName()
							);
						}
						if ( referencedColumnValues.length != span ) {
							throw new IdentifierGenerationException(
									"Mismatch between generated column values and column count for composite id property: "
											+ property.getName()
							);
						}
						System.arraycopy( referencedColumnValues, 0, columnValues, columnIndex, span );
					}
				}
				else if ( !onExecutionGenerator.allowMutation() ) {
					for ( int j = 0; j < span; j++ ) {
						columnInclusions[columnIndex + j] = false;
					}
				}
			}
			columnIndex += span;
		}

		final var generator =
				new CompositeNestedGeneratedValueGenerator(

View on GitHub (pinned to fad1729dce)

Solutions

  1. Make the number of generated column values match the column count of the composite id property.

When it happens

Trigger: Generated column values declared for a composite identifier are missing or do not match the column count.

Common situations: Composite ids with per-column generated values where the supplied values are absent or fewer/more than the id columns.


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