From 9d131ce69f76a3f8b1527923b9d6d5af234209af Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 15 Sep 2021 09:31:45 +0200 Subject: [PATCH] Minor code cleaning --- .../java/org/hibernate/query/sqm/internal/QuerySqmImpl.java | 2 ++ .../sql/results/jdbc/internal/DeferredResultSetAccess.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java index 9be41f7282..6139e75781 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java @@ -547,12 +547,14 @@ public class QuerySqmImpl throw new PersistenceException( "Unrecognized unwrap type [" + cls.getName() + "]" ); } + @Override protected boolean applyNativeQueryLockMode(Object value) { throw new IllegalStateException( "Illegal attempt to set lock mode on non-native query via hint; use Query#setLockMode instead" ); } + @Override protected boolean applySynchronizeSpacesHint(Object value) { throw new IllegalStateException( "Illegal attempt to set synchronized spaces on non-native query via hint" diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/DeferredResultSetAccess.java b/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/DeferredResultSetAccess.java index 756bdd100e..33d6b10f78 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/DeferredResultSetAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/DeferredResultSetAccess.java @@ -71,7 +71,7 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess { // Note that limit and lock aren't set for SQM as that is applied during SQL rendering // But for native queries, we have to adapt the SQL string final Dialect dialect = executionContext.getSession().getJdbcServices().getDialect(); - String sql = jdbcSelect.getSql(); + String sql; limit = queryOptions.getLimit(); if ( limit == null || limit.isEmpty() || jdbcSelect.usesLimitParameters() ) { sql = jdbcSelect.getSql();