hibernate/hibernate-orm · error · HibernateException
increment size cannot be less than 1
Error message
increment size cannot be less than 1
What it means
Error "increment size cannot be less than 1" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/id/enhanced/PooledOptimizer.java:69
public class PooledOptimizer extends AbstractOptimizer implements InitialValueAwareOptimizer {
private static class GenerationState {
private Long hiValue;
private long value;
}
private long initialValue = -1;
/**
* Constructs a {@code PooledOptimizer}
*
* @param returnClass The Java type of the values to be generated
* @param incrementSize The increment size.
*/
public PooledOptimizer(Class<?> returnClass, int incrementSize) {
super( returnClass, incrementSize );
if ( incrementSize < 1 ) {
throw new HibernateException( "increment size cannot be less than 1" );
}
OPTIMIZER_MESSAGE_LOGGER.creatingPooledOptimizer( incrementSize, returnClass.getName() );
}
@Override
public Serializable generate(AccessCallback callback) {
lock.lock();
try {
final var generationState = locateGenerationState( callback.getTenantIdentifier() );
if ( generationState.hiValue == null ) {
generationState.hiValue = callback.getNextValue();
// unfortunately not really safe to normalize this
// to 1 as an initial value like we do for the others
// because we would not be able to control this if
// we are using a sequence...
if ( generationState.hiValue < 1 ) {
OPTIMIZER_MESSAGE_LOGGER.pooledOptimizerReportedInitialValue( generationState.hiValue );
}View on GitHub (pinned to fad1729dce)
Solutions
- Set the generator increment size (allocationSize) to a value >= 1.
When it happens
Trigger: Thrown when an identifier optimizer is configured with an increment size smaller than 1.
Common situations: Typical situations: setting hibernate.id.optimizer or allocationSize to 0 or a negative value; a mismatched sequence increment combined with an invalid optimizer configuration.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/db227f7910c96237.
Report an issue: GitHub.