hibernate/hibernate-orm · error · IllegalArgumentException
Unsupported lock mode : {lockMode}
Error message
Unsupported lock mode : {lockMode} What it means
Error "Unsupported lock mode : {lockMode}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java:2456
/**
* A {@link LockingStrategy} which is able to acquire a database-level
* lock with the specified {@linkplain LockMode level}.
*
* @param lockable The persister for the entity to be locked.
* @param lockMode The type of lock to be acquired.
* @return The appropriate locking strategy.
*
* @since 7
*/
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode, PessimisticLockScope lockScope) {
return switch (lockMode) {
case PESSIMISTIC_FORCE_INCREMENT -> buildPessimisticForceIncrementStrategy( lockable, lockMode, lockScope );
case UPGRADE_NOWAIT, UPGRADE_SKIPLOCKED, PESSIMISTIC_WRITE -> buildPessimisticWriteStrategy( lockable, lockMode, lockScope );
case PESSIMISTIC_READ -> buildPessimisticReadStrategy( lockable, lockMode, lockScope );
case OPTIMISTIC_FORCE_INCREMENT -> buildOptimisticForceIncrementStrategy( lockable, lockMode );
case OPTIMISTIC -> buildOptimisticStrategy( lockable, lockMode );
case READ -> buildReadStrategy( lockable, lockMode, lockScope );
default -> throw new IllegalArgumentException( "Unsupported lock mode : " + lockMode );
};
}
/**
* A {@link LockingStrategy} which is able to acquire a database-level
* lock with the specified {@linkplain LockMode level}.
*
* @param lockable The persister for the entity to be locked.
* @param lockMode The type of lock to be acquired.
* @return The appropriate locking strategy.
*
* @since 3.2
*
* @deprecated Use {@linkplain #getLockingStrategy(EntityPersister, LockMode, PessimisticLockScope)} instead.
*/
@Deprecated(since = "7", forRemoval = true)
public LockingStrategy getLockingStrategy(EntityPersister lockable, LockMode lockMode) {
return getLockingStrategy( lockable, lockMode, PessimisticLockScope.NORMAL );View on GitHub (pinned to fad1729dce)
Solutions
- Use a LockMode supported by the database (e.g. PESSIMISTIC_READ/WRITE).
- Upgrade to a dialect version that supports the requested lock mode.
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported lock mode : the requested lock mode.
Common situations: Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: Unsupported lock mode : the requested lock mode.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/18430876d42ad3d0.
Report an issue: GitHub.