hibernate/hibernate-orm · error · IllegalArgumentException
Fetch-profile is not relevant for non-select NativeQuery
Error message
Fetch-profile is not relevant for non-select NativeQuery
What it means
Error "Fetch-profile is not relevant for non-select NativeQuery" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java:958
}
@Override
protected void applyResultCachingRegionHint(String hintName, Object value) {
if ( isNotSelectForSure() ) {
throw new IllegalArgumentException( "Result-caching is not relevant for non-select NativeQuery" );
}
super.applyResultCachingRegionHint( hintName, value );
}
@Override
protected void applyEntityGraphHint(GraphSemantic graphSemantic, Object value, String hintName) {
throw new HibernateException( "A native SQL query cannot use EntityGraphs" );
}
@Override
protected void applyEnabledFetchProfileHint(String hintName, Object value) {
if ( isNotSelectForSure() ) {
throw new IllegalArgumentException( "Fetch-profile is not relevant for non-select NativeQuery" );
}
super.applyEnabledFetchProfileHint( hintName, value );
}
@Override
protected void applyLockTimeoutHint(String hintName, Object value) {
if ( isNotSelectForSure() ) {
throw new IllegalArgumentException( "Locking is not relevant for non-select NativeQuery" );
}
super.applyLockTimeoutHint( hintName, value );
super.applyLockTimeoutHint( hintName, value );
}
@Override
protected void applyFollowOnStrategyHint(Object value) {
if ( isNotSelectForSure() ) {
throw new IllegalArgumentException( "Locking is not relevant for non-select NativeQuery" );
}View on GitHub (pinned to fad1729dce)
Solutions
- Fetch profiles only apply to selecting queries; the query is a non-select native query.
- Remove fetch-profile usage for mutation native queries.
When it happens
Trigger: An API operation is invoked on a query object that does not support it.
Common situations: Calling query hint, locking, pagination, conversion, or mutation APIs on a query kind (native vs HQL, select vs mutation) that does not implement them.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/a8c57d68650682e3.
Report an issue: GitHub.