{"record":{"id":"0b8cc70668b0e327","repo":"hibernate/hibernate-orm","slug":"the-increment-size-of-the-s-sequence-is-set-to","errorCode":null,"errorMessage":"The increment size of the [%s] sequence is set to [%d] in the entity mapping but the mapped database sequence increment size is [%d]","messagePattern":"The increment size of the \\[(.+?)\\] sequence is set to \\[(.+?)\\] in the entity mapping but the mapped database sequence increment size is \\[(.+?)\\]","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java","lineNumber":311,"sourceCode":"\t\t\t\tisSchemaToBeRecreated( contributor, configurationService ) ? null\n\t\t\t\t\t\t: getSequenceIncrementValue( jdbcEnvironment, databaseSequenceName );\n\t\tif ( databaseIncrementValue != null && databaseIncrementValue.intValue() != incrementSize ) {\n\t\t\tfinal int dbIncrementValue = databaseIncrementValue.intValue();\n\t\t\treturn switch ( sequenceMismatchStrategy ) {\n\t\t\t\tcase NONE -> incrementSize;\n\t\t\t\tcase FIX -> {\n\t\t\t\t\t// log at TRACE level\n\t\t\t\t\tSEQUENCE_GENERATOR_LOGGER.sequenceIncrementSizeMismatchFixed(\n\t\t\t\t\t\t\tdatabaseSequenceName, incrementSize, dbIncrementValue );\n\t\t\t\t\tyield dbIncrementValue;\n\t\t\t\t}\n\t\t\t\tcase LOG -> {\n\t\t\t\t\t// log at WARN level\n\t\t\t\t\tSEQUENCE_GENERATOR_LOGGER.sequenceIncrementSizeMismatch(\n\t\t\t\t\t\t\tdatabaseSequenceName, incrementSize, dbIncrementValue );\n\t\t\t\t\tyield incrementSize;\n\t\t\t\t}\n\t\t\t\tcase EXCEPTION -> throw new MappingException(\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\"The increment size of the [%s] sequence is set to [%d] in the entity mapping \"\n\t\t\t\t\t\t\t\t\t+ \"but the mapped database sequence increment size is [%d]\",\n\t\t\t\t\t\t\t\tdatabaseSequenceName, incrementSize, dbIncrementValue\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t\telse {\n\t\t\treturn incrementSize;\n\t\t}\n\t}\n\n\tprivate boolean isSchemaToBeRecreated(String contributor, ConfigurationService configurationService) {\n\t\tfinal var actions =\n\t\t\t\tActionGrouping.interpret( singleton( contributor ),\n\t\t\t\t\t\tconfigurationService.getSettings() );\n\t\t// We know this will only contain at most 1 action","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java#L293-L329","documentation":"Error \"The increment size of the [%s] sequence is set to [%d] in the entity mapping but the mapped database sequence increment size is [%d]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when the entity mapping's sequence increment size does not match the database sequence's actual increment.","commonSituations":"Typical situations: DBA changed the sequence increment; allocationSize in the mapping differs from the DDL; mismatch strategy set to EXCEPTION.","solutions":["Align the mapping's allocationSize with the database sequence's INCREMENT BY value.","Or set hibernate.id.sequence.increment_size_mismatch_strategy=FIX to auto-correct.","Or recreate the database sequence with the matching increment."],"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"}