cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2366 Incorrect EJBQL COUNT translation
Date Mon, 25 Sep 2017 12:41:27 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 2cb46bef1 -> 25f3ba07e


CAY-2366 Incorrect EJBQL COUNT translation


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

Branch: refs/heads/STABLE-4.0
Commit: 25f3ba07e940dfe38161b4a8e76a183fffa2f25e
Parents: 2cb46be
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Mon Sep 25 15:22:51 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Mon Sep 25 15:22:51 2017 +0300

----------------------------------------------------------------------
 .../ejbql/EJBQLAggregateColumnTranslator.java   |  10 +-
 .../org/apache/cayenne/CayenneCompoundIT.java   |  17 +++
 .../cayenne/access/QuotedIdentifiersIT.java     |   9 ++
 .../cayenne/access/VerticalInheritanceIT.java   |  34 +++++
 .../apache/cayenne/query/EJBQLQueryCountIT.java |  44 ++++---
 .../cayenne/testdo/compound/CompoundIntPk.java  |  28 ++++
 .../testdo/compound/auto/_CompoundIntPk.java    |  44 +++++++
 .../src/test/resources/compound.map.xml         | 132 ++++++++++---------
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |   1 +
 9 files changed, 238 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLAggregateColumnTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLAggregateColumnTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLAggregateColumnTranslator.java
index 7a5da20..4c946f0 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLAggregateColumnTranslator.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLAggregateColumnTranslator.java
@@ -146,7 +146,7 @@ class EJBQLAggregateColumnTranslator extends EJBQLBaseVisitor {
             }
 
             DbAttribute pk = getPk(relationship.getTargetEntity().getDbEntity());
-            context.append(lastAlias).append('.').append(pk.getName());
+            context.append(lastAlias).append('.').append(context.getQuotingStrategy().quotedName(pk));
         }
     }
 
@@ -171,9 +171,11 @@ class EJBQLAggregateColumnTranslator extends EJBQLBaseVisitor {
             if(classDescriptor == null) {
                 throw new EJBQLException("Unmapped id variable: " + expression.getText());
             }
-            String alias = context.getTableAlias(expression.getText(), classDescriptor.getEntity().getDbEntityName());
-            DbAttribute pk = getPk(classDescriptor.getEntity().getDbEntity());
-            context.append(alias).append('.').append(pk.getName());
+
+            DbEntity dbEntity = classDescriptor.getEntity().getDbEntity();
+            String tableName = context.getQuotingStrategy().quotedFullyQualifiedName(dbEntity);
+            context.append(context.getTableAlias(expression.getText(), tableName))
+                    .append('.').append(context.getQuotingStrategy().quotedName(getPk(dbEntity)));
             return false;
         }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/CayenneCompoundIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/CayenneCompoundIT.java b/cayenne-server/src/test/java/org/apache/cayenne/CayenneCompoundIT.java
index 191c725..ea822d0 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/CayenneCompoundIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/CayenneCompoundIT.java
@@ -21,6 +21,7 @@ package org.apache.cayenne;
 
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.exp.Property;
+import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
@@ -33,6 +34,7 @@ import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -53,6 +55,7 @@ public class CayenneCompoundIT extends ServerCase {
 
 	protected TableHelper tCompoundPKTest;
 	protected TableHelper tCharPKTest;
+	protected TableHelper tCompoundIntPKTest;
 
 	@Before
 	public void setUp() throws Exception {
@@ -61,6 +64,9 @@ public class CayenneCompoundIT extends ServerCase {
 
 		tCharPKTest = new TableHelper(dbHelper, "CHAR_PK_TEST");
 		tCharPKTest.setColumns("PK_COL", "OTHER_COL");
+
+		tCompoundIntPKTest = new TableHelper(dbHelper, "COMPOUND_INT_PK");
+		tCompoundIntPKTest.setColumns("id1", "id2", "name");
 	}
 
 	private void createOneCompoundPK() throws Exception {
@@ -181,4 +187,15 @@ public class CayenneCompoundIT extends ServerCase {
 			assertEquals(CompoundPkTestEntity.class, next[1].getClass());
 		}
 	}
+
+	@Test
+	public void testEjbqlCountSelect() throws Exception {
+		tCompoundIntPKTest.insert(1, 2, "test");
+		tCompoundIntPKTest.insert(2, 3, "test");
+		tCompoundIntPKTest.insert(1, 4, "test");
+		tCompoundIntPKTest.insert(2, 5, "test");
+
+		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(a) FROM CompoundIntPk a");
+		assertEquals(Collections.singletonList(4L), context.performQuery(query));
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/access/QuotedIdentifiersIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/QuotedIdentifiersIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/QuotedIdentifiersIT.java
index 5ab8a96..b9174c9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/QuotedIdentifiersIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/QuotedIdentifiersIT.java
@@ -156,4 +156,13 @@ public class QuotedIdentifiersIT extends ServerCase {
         assertEquals("Name", resultList.get(1).getName());
     }
 
+    @Test
+    public void testQuotedEJBQLCountQuery() throws Exception {
+        EJBQLQuery query = new EJBQLQuery("select count(p) from Quote_Person p");
+        assertEquals(Collections.singletonList(2L), context.performQuery(query));
+
+        query = new EJBQLQuery("select count(p.fULL_name) from Quote_Person p");
+        assertEquals(Collections.singletonList(0L), context.performQuery(query));
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
index 7ffb996..fb01ff2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/VerticalInheritanceIT.java
@@ -20,6 +20,7 @@ package org.apache.cayenne.access;
 
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.query.SelectById;
 import org.apache.cayenne.query.SelectQuery;
@@ -35,6 +36,7 @@ import org.junit.Test;
 
 import java.sql.SQLException;
 import java.sql.Types;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -752,4 +754,36 @@ public class VerticalInheritanceIT extends ServerCase {
 		context.commitChanges();
 	}
 
+	@Test
+	public void testCountEjbqlQuery() throws Exception {
+		TableHelper ivRootTable = new TableHelper(dbHelper, "IV_ROOT");
+		ivRootTable.setColumns("ID", "NAME", "DISCRIMINATOR");
+
+		TableHelper ivSub1Table = new TableHelper(dbHelper, "IV_SUB1");
+		ivSub1Table.setColumns("ID", "SUB1_NAME");
+
+		TableHelper ivSub2Table = new TableHelper(dbHelper, "IV_SUB2");
+		ivSub2Table.setColumns("ID", "SUB2_ATTR", "SUB2_NAME");
+
+		// Root, IvSub1, IvSub2
+
+		ivRootTable.insert(1, "root1", "");
+
+		ivRootTable.insert(2, "sub11", "IvSub1");
+		ivSub1Table.insert(2, "sub_name1_1");
+
+		ivRootTable.insert(3, "sub21", "IvSub2");
+		ivRootTable.insert(4, "sub22", "IvSub2");
+		ivSub2Table.insert(3, "attr1", "sub_name2_1");
+		ivSub2Table.insert(4, "attr2", "sub_name2_2");
+
+		EJBQLQuery query1 = new EJBQLQuery("SELECT COUNT(a) FROM IvRoot a");
+		assertEquals(Collections.singletonList(4L), context.performQuery(query1));
+
+		EJBQLQuery query2 = new EJBQLQuery("SELECT COUNT(a) FROM IvSub1 a");
+		assertEquals(Collections.singletonList(1L), context.performQuery(query2));
+
+		EJBQLQuery query3 = new EJBQLQuery("SELECT COUNT(a) FROM IvSub2 a");
+		assertEquals(Collections.singletonList(2L), context.performQuery(query3));
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryCountIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryCountIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryCountIT.java
index 9dd7ace..fc85b3f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryCountIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryCountIT.java
@@ -55,6 +55,18 @@ public class EJBQLQueryCountIT extends ServerCase {
 	}
 
 	@Test
+	public void test_SimpleCount() throws Exception {
+		tArtist.insert(1, "A1");
+		tArtist.insert(2, "A2");
+		tArtist.insert(3, "A3");
+
+		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(a) FROM Artist a");
+
+		// this should be simply a count of painting/artist joins
+		assertEquals(Collections.singletonList(3L), context.performQuery(query));
+	}
+
+	@Test
 	public void test_ToOne() throws Exception {
 		tArtist.insert(1, "A1");
 		tArtist.insert(2, "A2");
@@ -67,23 +79,23 @@ public class EJBQLQueryCountIT extends ServerCase {
 		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(p.toArtist) FROM Painting p");
 
 		// this should be simply a count of painting/artist joins
-		assertEquals(Collections.singletonList(3l), context.performQuery(query));
+		assertEquals(Collections.singletonList(3L), context.performQuery(query));
 	}
 
-//	@Test
-//	public void test_DistinctToOne() throws Exception {
-//		tArtist.insert(1, "A1");
-//		tArtist.insert(2, "A2");
-//		tArtist.insert(3, "A3");
-//
-//		tPainting.insert(1, 1, "P1");
-//		tPainting.insert(2, 1, "P2");
-//		tPainting.insert(4, 2, "P1");
-//
-//		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(DISTINCT p.toArtist) FROM Painting p");
-//		// this should be a count of artists that have paintings
-//		assertEquals(Collections.singletonList(2l), context.performQuery(query));
-//	}
+	@Test
+	public void test_DistinctToOne() throws Exception {
+		tArtist.insert(1, "A1");
+		tArtist.insert(2, "A2");
+		tArtist.insert(3, "A3");
+
+		tPainting.insert(1, 1, "P1");
+		tPainting.insert(2, 1, "P2");
+		tPainting.insert(4, 2, "P1");
+
+		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(DISTINCT p.toArtist) FROM Painting p");
+		// this should be a count of artists that have paintings
+		assertEquals(Collections.singletonList(2l), context.performQuery(query));
+	}
 	
 	@Test
 	public void test_DistinctToOneAttribute() throws Exception {
@@ -97,7 +109,7 @@ public class EJBQLQueryCountIT extends ServerCase {
 
 		EJBQLQuery query = new EJBQLQuery("SELECT COUNT(DISTINCT p.toArtist.artistName) FROM Painting
p");
 		// this should be a count of artists that have paintings
-		assertEquals(Collections.singletonList(1l), context.performQuery(query));
+		assertEquals(Collections.singletonList(1L), context.performQuery(query));
 	}
 	
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/CompoundIntPk.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/CompoundIntPk.java
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/CompoundIntPk.java
new file mode 100644
index 0000000..19d3040
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/CompoundIntPk.java
@@ -0,0 +1,28 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.testdo.compound;
+
+import org.apache.cayenne.testdo.compound.auto._CompoundIntPk;
+
+public class CompoundIntPk extends _CompoundIntPk {
+
+    private static final long serialVersionUID = 1L; 
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/auto/_CompoundIntPk.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/auto/_CompoundIntPk.java
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/auto/_CompoundIntPk.java
new file mode 100644
index 0000000..58ab110
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/compound/auto/_CompoundIntPk.java
@@ -0,0 +1,44 @@
+package org.apache.cayenne.testdo.compound.auto;
+
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.exp.Property;
+
+/**
+ * Class _CompoundIntPk was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _CompoundIntPk extends CayenneDataObject {
+
+    private static final long serialVersionUID = 1L; 
+
+    public static final String ID1_PK_COLUMN = "id1";
+    public static final String ID2_PK_COLUMN = "id2";
+
+    public static final Property<Integer> ID1 = Property.create("id1", Integer.class);
+    public static final Property<Integer> ID2 = Property.create("id2", Integer.class);
+    public static final Property<String> NAME = Property.create("name", String.class);
+
+    public void setId1(Integer id1) {
+        writeProperty("id1", id1);
+    }
+    public Integer getId1() {
+        return (Integer)readProperty("id1");
+    }
+
+    public void setId2(Integer id2) {
+        writeProperty("id2", id2);
+    }
+    public Integer getId2() {
+        return (Integer)readProperty("id2");
+    }
+
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/cayenne-server/src/test/resources/compound.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/compound.map.xml b/cayenne-server/src/test/resources/compound.map.xml
index d4210ab..04bc4c4 100644
--- a/cayenne-server/src/test/resources/compound.map.xml
+++ b/cayenne-server/src/test/resources/compound.map.xml
@@ -1,64 +1,74 @@
 <?xml version="1.0" encoding="utf-8"?>
 <data-map xmlns="http://cayenne.apache.org/schema/9/modelMap"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
-          project-version="9">
-    <property name="defaultPackage" value="org.apache.cayenne.testdo.compound"/>
-    <property name="defaultSuperclass" value="org.apache.cayenne.CayenneDataObject"/>
-    <property name="clientSupported" value="true"/>
-    <property name="defaultClientPackage" value="test.client"/>
-    <property name="defaultClientSuperclass" value="org.apache.cayenne.PersistentObject"/>
-    <db-entity name="CHAR_FK_TEST">
-        <db-attribute name="FK_COL" type="CHAR" length="10"/>
-        <db-attribute name="NAME" type="VARCHAR" length="100"/>
-        <db-attribute name="PK" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-    </db-entity>
-    <db-entity name="CHAR_PK_TEST">
-        <db-attribute name="OTHER_COL" type="CHAR" length="10"/>
-        <db-attribute name="PK_COL" type="CHAR" isPrimaryKey="true" isMandatory="true"
length="10"/>
-    </db-entity>
-    <db-entity name="COMPOUND_FK_TEST">
-        <db-attribute name="F_KEY1" type="VARCHAR" length="20"/>
-        <db-attribute name="F_KEY2" type="VARCHAR" length="20"/>
-        <db-attribute name="NAME" type="VARCHAR" length="255"/>
-        <db-attribute name="PKEY" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-    </db-entity>
-    <db-entity name="COMPOUND_PK_TEST">
-        <db-attribute name="KEY1" type="VARCHAR" isPrimaryKey="true" isMandatory="true"
length="20"/>
-        <db-attribute name="KEY2" type="VARCHAR" isPrimaryKey="true" isMandatory="true"
length="20"/>
-        <db-attribute name="NAME" type="VARCHAR" length="255"/>
-    </db-entity>
-    <obj-entity name="CharFkTestEntity" className="org.apache.cayenne.testdo.compound.CharFkTestEntity"
dbEntityName="CHAR_FK_TEST">
-        <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
-    </obj-entity>
-    <obj-entity name="CharPkTestEntity" className="org.apache.cayenne.testdo.compound.CharPkTestEntity"
dbEntityName="CHAR_PK_TEST">
-        <obj-attribute name="otherCol" type="java.lang.String" db-attribute-path="OTHER_COL"/>
-        <obj-attribute name="pkCol" type="java.lang.String" db-attribute-path="PK_COL"/>
-    </obj-entity>
-    <obj-entity name="CompoundFkTestEntity" className="org.apache.cayenne.testdo.compound.CompoundFkTestEntity"
dbEntityName="COMPOUND_FK_TEST">
-        <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
-    </obj-entity>
-    <obj-entity name="CompoundPkTestEntity" className="org.apache.cayenne.testdo.compound.CompoundPkTestEntity"
dbEntityName="COMPOUND_PK_TEST">
-        <obj-attribute name="key1" type="java.lang.String" db-attribute-path="KEY1"/>
-        <obj-attribute name="key2" type="java.lang.String" db-attribute-path="KEY2"/>
-        <obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
-    </obj-entity>
-    <db-relationship name="toCharPK" source="CHAR_FK_TEST" target="CHAR_PK_TEST" toMany="false">
-        <db-attribute-pair source="FK_COL" target="PK_COL"/>
-    </db-relationship>
-    <db-relationship name="charFKs" source="CHAR_PK_TEST" target="CHAR_FK_TEST" toMany="true">
-        <db-attribute-pair source="PK_COL" target="FK_COL"/>
-    </db-relationship>
-    <db-relationship name="toCompoundPk" source="COMPOUND_FK_TEST" target="COMPOUND_PK_TEST"
toMany="false">
-        <db-attribute-pair source="F_KEY1" target="KEY1"/>
-        <db-attribute-pair source="F_KEY2" target="KEY2"/>
-    </db-relationship>
-    <db-relationship name="compoundFkArray" source="COMPOUND_PK_TEST" target="COMPOUND_FK_TEST"
toMany="true">
-        <db-attribute-pair source="KEY1" target="F_KEY1"/>
-        <db-attribute-pair source="KEY2" target="F_KEY2"/>
-    </db-relationship>
-    <obj-relationship name="toCharPK" source="CharFkTestEntity" target="CharPkTestEntity"
db-relationship-path="toCharPK"/>
-    <obj-relationship name="charFKs" source="CharPkTestEntity" target="CharFkTestEntity"
db-relationship-path="charFKs"/>
-    <obj-relationship name="toCompoundPk" source="CompoundFkTestEntity" target="CompoundPkTestEntity"
db-relationship-path="toCompoundPk"/>
-    <obj-relationship name="compoundFkArray" source="CompoundPkTestEntity" target="CompoundFkTestEntity"
db-relationship-path="compoundFkArray"/>
+	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	 xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
+	 project-version="9">
+	<property name="defaultPackage" value="org.apache.cayenne.testdo.compound"/>
+	<property name="defaultSuperclass" value="org.apache.cayenne.CayenneDataObject"/>
+	<property name="clientSupported" value="true"/>
+	<property name="defaultClientPackage" value="test.client"/>
+	<property name="defaultClientSuperclass" value="org.apache.cayenne.PersistentObject"/>
+	<db-entity name="CHAR_FK_TEST">
+		<db-attribute name="FK_COL" type="CHAR" length="10"/>
+		<db-attribute name="NAME" type="VARCHAR" length="100"/>
+		<db-attribute name="PK" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="CHAR_PK_TEST">
+		<db-attribute name="OTHER_COL" type="CHAR" length="10"/>
+		<db-attribute name="PK_COL" type="CHAR" isPrimaryKey="true" isMandatory="true" length="10"/>
+	</db-entity>
+	<db-entity name="COMPOUND_FK_TEST">
+		<db-attribute name="F_KEY1" type="VARCHAR" length="20"/>
+		<db-attribute name="F_KEY2" type="VARCHAR" length="20"/>
+		<db-attribute name="NAME" type="VARCHAR" length="255"/>
+		<db-attribute name="PKEY" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="COMPOUND_PK_TEST">
+		<db-attribute name="KEY1" type="VARCHAR" isPrimaryKey="true" isMandatory="true" length="20"/>
+		<db-attribute name="KEY2" type="VARCHAR" isPrimaryKey="true" isMandatory="true" length="20"/>
+		<db-attribute name="NAME" type="VARCHAR" length="255"/>
+	</db-entity>
+	<db-entity name="COMPOUND_INT_PK">
+		<db-attribute name="id1" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="id2" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="name" type="VARCHAR" length="100"/>
+	</db-entity>
+	<obj-entity name="CharFkTestEntity" className="org.apache.cayenne.testdo.compound.CharFkTestEntity"
dbEntityName="CHAR_FK_TEST">
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
+	</obj-entity>
+	<obj-entity name="CharPkTestEntity" className="org.apache.cayenne.testdo.compound.CharPkTestEntity"
dbEntityName="CHAR_PK_TEST">
+		<obj-attribute name="otherCol" type="java.lang.String" db-attribute-path="OTHER_COL"/>
+		<obj-attribute name="pkCol" type="java.lang.String" db-attribute-path="PK_COL"/>
+	</obj-entity>
+	<obj-entity name="CompoundFkTestEntity" className="org.apache.cayenne.testdo.compound.CompoundFkTestEntity"
dbEntityName="COMPOUND_FK_TEST">
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
+	</obj-entity>
+	<obj-entity name="CompoundPkTestEntity" className="org.apache.cayenne.testdo.compound.CompoundPkTestEntity"
dbEntityName="COMPOUND_PK_TEST">
+		<obj-attribute name="key1" type="java.lang.String" db-attribute-path="KEY1"/>
+		<obj-attribute name="key2" type="java.lang.String" db-attribute-path="KEY2"/>
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
+	</obj-entity>
+	<obj-entity name="CompoundIntPk" className="org.apache.cayenne.testdo.compound.CompoundIntPk"
dbEntityName="COMPOUND_INT_PK">
+		<obj-attribute name="id1" type="java.lang.Integer" db-attribute-path="id1"/>
+		<obj-attribute name="id2" type="java.lang.Integer" db-attribute-path="id2"/>
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
+	</obj-entity>
+	<db-relationship name="toCharPK" source="CHAR_FK_TEST" target="CHAR_PK_TEST" toMany="false">
+		<db-attribute-pair source="FK_COL" target="PK_COL"/>
+	</db-relationship>
+	<db-relationship name="charFKs" source="CHAR_PK_TEST" target="CHAR_FK_TEST" toMany="true">
+		<db-attribute-pair source="PK_COL" target="FK_COL"/>
+	</db-relationship>
+	<db-relationship name="toCompoundPk" source="COMPOUND_FK_TEST" target="COMPOUND_PK_TEST"
toMany="false">
+		<db-attribute-pair source="F_KEY1" target="KEY1"/>
+		<db-attribute-pair source="F_KEY2" target="KEY2"/>
+	</db-relationship>
+	<db-relationship name="compoundFkArray" source="COMPOUND_PK_TEST" target="COMPOUND_FK_TEST"
toMany="true">
+		<db-attribute-pair source="KEY1" target="F_KEY1"/>
+		<db-attribute-pair source="KEY2" target="F_KEY2"/>
+	</db-relationship>
+	<obj-relationship name="toCharPK" source="CharFkTestEntity" target="CharPkTestEntity"
db-relationship-path="toCharPK"/>
+	<obj-relationship name="charFKs" source="CharPkTestEntity" target="CharFkTestEntity"
db-relationship-path="charFKs"/>
+	<obj-relationship name="toCompoundPk" source="CompoundFkTestEntity" target="CompoundPkTestEntity"
db-relationship-path="toCompoundPk"/>
+	<obj-relationship name="compoundFkArray" source="CompoundPkTestEntity" target="CompoundFkTestEntity"
db-relationship-path="compoundFkArray"/>
 </data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/25f3ba07/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 7a7fa43..12df4b4 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -29,6 +29,7 @@ CAY-2358 NPE when callbacks invoked on null objects
 CAY-2359 EJBQL: db path in not supported in ORDER BY
 CAY-2362 ColumnSelect: unable to use Property without type
 CAY-2363 ColumnSelect: unable to use from nested context
+CAY-2366 Incorrect EJBQL COUNT translation
 
 ----------------------------------
 Release: 4.0.B1


Mime
View raw message