hibernate/hibernate-orm · error · MappingException

Native generation not supported for @CollectionId

Error message

Native generation not supported for @CollectionId

What it means

Error "Native generation not supported for @CollectionId" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdBagBinder.java:130

		}
		return result;
	}

	private static String generatorName(String generator) {
		return switch ( generator ) {
			case "sequence", "increment" -> "";
			default -> generator;
		};
	}

	private static void checkLegalCollectionIdStrategy(String namedGenerator) {
		switch ( namedGenerator ) {
			case "identity":
				throw new MappingException("IDENTITY generation not supported for @CollectionId");
			case "assigned":
				throw new MappingException("Assigned generation not supported for @CollectionId");
			case "native":
				throw new MappingException("Native generation not supported for @CollectionId");
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a generation strategy other than native for @CollectionId.

When it happens

Trigger: An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.

Common situations: @GeneratedValue pointing at a generator of the wrong kind (SEQUENCE vs TABLE), a missing named generator, too many generator annotations, or an unsupported generation strategy for @CollectionId.


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