{"record":{"id":"da43998bb9b9cbda","repo":"hibernate/hibernate-orm","slug":"generatedvalue-for-s-s-specified-table-genera","errorCode":null,"errorMessage":"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @SequenceGenerator","messagePattern":"@GeneratedValue for (.+?) \\((.+?)\\) specified TABLE generation, but referred to a @SequenceGenerator","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdGeneratorResolverSecondPass.java","lineNumber":192,"sourceCode":"\t\t\tif ( globalMatch != null ) {\n\t\t\t\thandleTableGenerator( generator, globalMatch.configuration() );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvalidateTableGeneration();\n\t\t\t\thandleTableGenerator( generator, null );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void validateTableGeneration() {\n\t\t// basically, make sure there is neither a SequenceGenerator nor a GenericGenerator with this name\n\n\t\tfinal var globalRegistrations = buildingContext.getMetadataCollector().getGlobalRegistrations();\n\t\tfinal String generator = generatedValue.generator();\n\n\t\tfinal var globalSequenceMatch = globalRegistrations.getSequenceGeneratorRegistrations().get( generator );\n\t\tif ( globalSequenceMatch != null ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @SequenceGenerator\",\n\t\t\t\t\t\t\tentityMapping.getEntityName(),\n\t\t\t\t\t\t\tgenerator\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tfinal var globalGenericMatch = globalRegistrations.getGenericGeneratorRegistrations().get( generator );\n\t\tif ( globalGenericMatch != null ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @GenericGenerator\",\n\t\t\t\t\t\t\tentityMapping.getEntityName(),\n\t\t\t\t\t\t\tgenerator\n\t\t\t\t\t)","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdGeneratorResolverSecondPass.java#L174-L210","documentation":"Error \"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @SequenceGenerator\" 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":["Reference a @TableGenerator for TABLE generation, or change the strategy to SEQUENCE."],"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"}