cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cayenne git commit: [CAY-2017] Malformed EJBQL from "isNull" expression
Date Tue, 23 Jun 2015 09:46:54 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master ec150004d -> faa48a481


[CAY-2017] Malformed EJBQL from "isNull" expression


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/faa48a48
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/faa48a48
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/faa48a48

Branch: refs/heads/master
Commit: faa48a481f57c85c0cbccc9ad3fe260b16601faf
Parents: ec15000
Author: Andrew Lindesay <apl@lindesay.co.nz>
Authored: Tue Jun 23 21:46:36 2015 +1200
Committer: Andrew Lindesay <apl@lindesay.co.nz>
Committed: Tue Jun 23 21:46:36 2015 +1200

----------------------------------------------------------------------
 .../java/org/apache/cayenne/exp/parser/ASTNot.java | 17 +++++++++--------
 .../org/apache/cayenne/exp/ExpressionTest.java     |  7 +++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/faa48a48/cayenne-server/src/main/java/org/apache/cayenne/exp/parser/ASTNot.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/exp/parser/ASTNot.java b/cayenne-server/src/main/java/org/apache/cayenne/exp/parser/ASTNot.java
index 13700e5..37d14b4 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/exp/parser/ASTNot.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/exp/parser/ASTNot.java
@@ -66,7 +66,7 @@ public class ASTNot extends AggregateConditionNode {
 		return new ASTNot(id);
 	}
 
-	@Override
+    @Override
 	public int getType() {
 		return Expression.NOT;
 	}
@@ -80,13 +80,14 @@ public class ASTNot extends AggregateConditionNode {
 		super.appendAsString(out);
 	}
 
-	/**
-	 * @since 4.0
-	 */
-	@Override
-	public void appendAsEJBQL(List<Object> parameterAccumulator, Appendable out, String
rootId) throws IOException {
-		appendAsString(out);
-	}
+    /**
+     * @since 4.0
+     */
+    @Override
+    public void appendAsEJBQL(List<Object> parameterAccumulator, Appendable out, String
rootId) throws IOException {
+        out.append("not ");
+        super.appendAsEJBQL(parameterAccumulator, out, rootId);
+    }
 
 	@Override
 	protected String getExpressionOperator(int index) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/faa48a48/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionTest.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionTest.java
index 2782724..b6616c4 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionTest.java
@@ -199,6 +199,13 @@ public class ExpressionTest {
 	}
 
 	@Test
+	public void testIsNotNullEx() {
+		Expression e = Artist.ARTIST_NAME.isNotNull();
+		String ejbql = e.toEJBQL("x");
+		assertEquals("not (x.artistName is null)", ejbql);
+	}
+
+	@Test
 	public void testAndExp() {
 		Expression e1 = ExpressionFactory.matchExp("name", "Picasso");
 		Expression e2 = ExpressionFactory.matchExp("age", 30);


Mime
View raw message