hibernate/hibernate-orm · error · UnsupportedOperationException
Registering lock modes should only be done for result set ma
Error message
Registering lock modes should only be done for result set mappings
What it means
Error "Registering lock modes should only be done for result set mappings" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSqlAstCreationState.java:177
@Override
public SqlAliasBaseGenerator getSqlAliasBaseGenerator() {
return sqlAliasBaseManager;
}
@Override
public LoadQueryInfluencers getLoadQueryInfluencers() {
return loadQueryInfluencers;
}
@Override
public boolean applyOnlyLoadByKeyFilters() {
return true;
}
@Override
public void registerLockMode(String identificationVariable, LockMode explicitLockMode) {
throw new UnsupportedOperationException( "Registering lock modes should only be done for result set mappings" );
}
@Override
public ImmutableFetchList visitFetches(FetchParent fetchParent) {
return fetchProcessor.visitFetches( fetchParent, this );
}
@Override
public <R> R withNestedFetchParent(FetchParent fetchParent, Function<FetchParent, R> action) {
final var nestingFetchParent = processingState.getNestingFetchParent();
processingState.setNestingFetchParent( fetchParent );
final R result = action.apply( fetchParent );
processingState.setNestingFetchParent( nestingFetchParent );
return result;
}
@Override
public boolean isResolvingCircularFetch() {View on GitHub (pinned to fad1729dce)
Solutions
- Only apply lock modes on result set mappings, not on scalar/other result types; adjust the native query lock mode registration.
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderSqlAstCreationState.java:177 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/9952943e99588c0f.
Report an issue: GitHub.