diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java index 717d07317d..5bbf654663 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java @@ -33,10 +33,17 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { @Override public String processSql(String sql, Limit limit, QueryOptions queryOptions) { + final boolean hasFirstRow = hasFirstRow( limit ); + final boolean hasMaxRows = hasMaxRows( limit ); + + if ( !hasFirstRow && !hasMaxRows ) { + return sql; + } + return processSql( sql, - hasFirstRow( limit ), - hasMaxRows( limit ), + hasFirstRow, + hasMaxRows, queryOptions.getLockOptions() ); }