{"record":{"id":"81c71b8a36ef8f17","repo":"hibernate/hibernate-orm","slug":"native-generation-not-supported-for-collectionid","errorCode":null,"errorMessage":"Native generation not supported for @CollectionId","messagePattern":"Native generation not supported for @CollectionId","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdBagBinder.java","lineNumber":130,"sourceCode":"\t\t}\n\t\treturn result;\n\t}\n\n\tprivate static String generatorName(String generator) {\n\t\treturn switch ( generator ) {\n\t\t\tcase \"sequence\", \"increment\" -> \"\";\n\t\t\tdefault -> generator;\n\t\t};\n\t}\n\n\tprivate static void checkLegalCollectionIdStrategy(String namedGenerator) {\n\t\tswitch ( namedGenerator ) {\n\t\t\tcase \"identity\":\n\t\t\t\tthrow new MappingException(\"IDENTITY generation not supported for @CollectionId\");\n\t\t\tcase \"assigned\":\n\t\t\t\tthrow new MappingException(\"Assigned generation not supported for @CollectionId\");\n\t\t\tcase \"native\":\n\t\t\t\tthrow new MappingException(\"Native generation not supported for @CollectionId\");\n\t\t}\n\t}\n}\n","sourceCodeStart":112,"sourceCodeEnd":134,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdBagBinder.java#L112-L134","documentation":"Error \"Native generation not supported for @CollectionId\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.","commonSituations":"@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.","solutions":["Use a generation strategy other than native for @CollectionId."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}