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 3067a01a81..c4d7f23f15 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 @@ -52,6 +52,7 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { if ( !hasMaxRows ) { return sql; } + sql = sql.trim(); final LockOptions lockOptions = queryParameters.getLockOptions(); if ( lockOptions != null ) { @@ -83,7 +84,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { bindLimitParametersInReverseOrder = false; useMaxForLimit = false; - sql = normalizeStatement( sql ); final int offsetFetchLength; final String offsetFetchString; if ( hasFirstRow ) { @@ -100,7 +100,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) { bindLimitParametersInReverseOrder = true; useMaxForLimit = true; - sql = normalizeStatement( sql ); String forUpdateClause = null; boolean isForUpdate = false; @@ -142,10 +141,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { return pagingSelect.toString(); } - private String normalizeStatement(String sql) { - return sql.trim().replaceAll( "\\s+", " " ); - } - private int getForUpdateIndex(String sql) { final int forUpdateLastIndex = sql.toLowerCase( Locale.ROOT ).lastIndexOf( "for update" ); // We need to recognize cases like : select a from t where b = 'for update';