diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/query/internal/SelectStatementBuilder.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/query/internal/SelectStatementBuilder.java index 834e6d970b..cbddf7c5da 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/query/internal/SelectStatementBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/query/internal/SelectStatementBuilder.java @@ -125,10 +125,10 @@ public class SelectStatementBuilder { private String cleanRestrictions(String restrictions) { restrictions = restrictions.trim(); - if ( restrictions.startsWith( "and" ) ) { + if ( restrictions.startsWith( "and " ) ) { restrictions = restrictions.substring( 4 ); } - if ( restrictions.endsWith( "and" ) ) { + if ( restrictions.endsWith( " and" ) ) { restrictions = restrictions.substring( 0, restrictions.length()-4 ); }