{"record":{"id":"c6c5a3b4f8d624ce","repo":"hibernate/hibernate-orm","slug":"generator-does-not-generate-before-execution","errorCode":null,"errorMessage":"Generator does not generate before execution: {}","messagePattern":"Generator does not generate before execution: (.+?)","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/id/GenericGeneratorGeneration.java","lineNumber":242,"sourceCode":"\n\t@Override\n\tpublic boolean supportsBulkInsertionIdentifierGeneration() {\n\t\treturn delegate instanceof BulkInsertionCapableIdentifierGenerator generator\n\t\t\t\t&& generator.supportsBulkInsertionIdentifierGeneration();\n\t}\n\n\t@Override\n\tpublic String determineBulkInsertionIdentifierGenerationSelectFragment(SqlStringGenerationContext context) {\n\t\treturn delegate instanceof BulkInsertionCapableIdentifierGenerator generator\n\t\t\t\t? generator.determineBulkInsertionIdentifierGenerationSelectFragment( context )\n\t\t\t\t: null;\n\t}\n\n\tprivate BeforeExecutionGenerator beforeExecutionGenerator() {\n\t\tif ( delegate instanceof BeforeExecutionGenerator beforeExecutionGenerator ) {\n\t\t\treturn beforeExecutionGenerator;\n\t\t}\n\t\tthrow new HibernateException( \"Generator does not generate before execution: \" + delegate.getClass().getName() );\n\t}\n\n\tprivate OnExecutionGenerator onExecutionGenerator() {\n\t\tif ( delegate instanceof OnExecutionGenerator onExecutionGenerator ) {\n\t\t\treturn onExecutionGenerator;\n\t\t}\n\t\tthrow new HibernateException( \"Generator does not generate on execution: \" + delegate.getClass().getName() );\n\t}\n}\n","sourceCodeStart":224,"sourceCodeEnd":252,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/id/GenericGeneratorGeneration.java#L224-L252","documentation":"Error \"Generator does not generate before execution: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a value generator is invoked at a timing (before/during execution) it does not support.","commonSituations":"Typical situations: a database-side (on-execution) generator used where an in-memory (before-execution) generator is required, or vice versa.","solutions":["Use a generator that supports pre-execution (in-memory) generation, or adjust the mapping so the generator's timing matches its capability."],"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"}