Bug 530214: TRIM(... FROM ...) operation fails for literal binding
Signed-off-by: Will Dazey <dazeydev.3@gmail.com>
Reviewed-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/expressions/ExpressionOperator.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/expressions/ExpressionOperator.java
index c4264c2..41b2ef7 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/expressions/ExpressionOperator.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/expressions/ExpressionOperator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -12,6 +12,8 @@
* Markus Karg - allow arguments to be specified multiple times in argumentIndices
* 05/07/2009-1.1.1 Dave Brosius
* - 263904: [PATCH] ExpressionOperator doesn't compare arrays correctly
+ * 01/23/2018-2.7 Will Dazey
+ * - 530214: trim operation should not bind parameters
******************************************************************************/
package org.eclipse.persistence.expressions;
@@ -3041,6 +3043,7 @@ public static ExpressionOperator trim2() {
exOperator.printsAs(v);
exOperator.bePrefix();
exOperator.setNodeClass(ClassConstants.FunctionExpression_Class);
+ exOperator.setIsBindingSupported(false);
return exOperator;
}
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java
index 9f5586e..2e6948e 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/jpql/JUnitJPQLComplexTestSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1998, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -12,6 +12,8 @@
*
* 04/11/2017-2.6 Will Dazey
* - 512386: Add constructor initialization with CONCAT test
+ * 01/23/2018-2.7 Will Dazey
+ * - 530214: trim operation should not bind parameters
******************************************************************************/
package org.eclipse.persistence.testing.tests.jpa.jpql;
@@ -3138,6 +3140,7 @@ public void variableReferencedOnlyInParameterTest() {
"SELECT CONCAT(e.firstName, 'b') FROM Employee e",
"SELECT SUBSTRING(e.firstName, 1, 2) FROM Employee e",
"SELECT TRIM(e.firstName) FROM Employee e",
+ "SELECT TRIM('A' FROM e.firstName) FROM Employee e",
"SELECT TRIM(LEADING FROM e.firstName) FROM Employee e",
"SELECT TRIM(TRAILING FROM e.firstName) FROM Employee e",
"SELECT TRIM(LEADING 'A' FROM e.firstName) FROM Employee e",