cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1150338 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ framework/cayen...
Date Sun, 24 Jul 2011 11:07:48 GMT
Author: aadamchik
Date: Sun Jul 24 11:07:46 2011
New Revision: 1150338

URL: http://svn.apache.org/viewvc?rev=1150338&view=rev
Log:
undoing CAY-1582 commits

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/Iv2Root.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/Iv2Sub1.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/Iv2Sub2.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/auto/_Iv2Root.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/auto/_Iv2Sub1.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance/vertical/auto/_Iv2Sub2.java
Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLTranslationContext.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/VerticalInheritanceTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-vertical.map.xml

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Jul 24 11:07:46 2011
@@ -36,7 +36,6 @@ CAY-1577 SQL queries for LIKE expression
 CAY-1581 Not-Escaping <> during serialization to *.map.xml
 CAY-1583 context.getObjectStore() returning null causing NullpointerException in DataMergeHandler
 CAY-1585 SelectQuery automatic cache key needs FetchOffset
-CAY-1582 EJBQL queries are broken for vertical inheritance entities
 CAY-1539 Incorrect offset handling on some queries against database with supported LIMIT/OFFSET
clauses
 
 ----------------------------------

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
Sun Jul 24 11:07:46 2011
@@ -639,24 +639,14 @@ public class EJBQLConditionTranslator ex
     @Override
     public boolean visitIdentificationVariable(EJBQLExpression expression) {
         // this is a match on a variable, like "x = :x"
-        DbEntity table;
-        // first looking for joined entity
-        List<DbRelationship> joinRelationships = context.getIncomingRelationships(
-                new EJBQLTableId(expression.getText()));
-        if (!joinRelationships.isEmpty()) {
-            // joined entity, get last joined table as entity table
-            DbRelationship incoming = joinRelationships.get(joinRelationships.size() - 1);
-            table = (DbEntity) incoming.getTargetEntity();
-        } else {
-            // not joined entity, get entity table
+
         ClassDescriptor descriptor = context.getEntityDescriptor(expression.getText());
         if (descriptor == null) {
             throw new EJBQLException("Invalid identification variable: "
                     + expression.getText());
         }
-            table = descriptor.getEntity().getDbEntity();
-        }
 
+        DbEntity table = descriptor.getEntity().getDbEntity();
         String alias = context.getTableAlias(expression.getText(), table
                 .getFullyQualifiedName());
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
Sun Jul 24 11:07:46 2011
@@ -164,7 +164,7 @@ public class EJBQLJoinAppender {
 
                     }
 
-                    context.append(' ').append(semantics).append(' ');
+                    context.append(" JOIN ");
                     context.append(subqueryTargetTableName).append(' ').append(
                             subqueryTargetAlias);
                     generateJoiningExpression(

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLTranslationContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLTranslationContext.java?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLTranslationContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLTranslationContext.java
Sun Jul 24 11:07:46 2011
@@ -19,7 +19,6 @@
 package org.apache.cayenne.access.jdbc;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -30,15 +29,12 @@ import org.apache.cayenne.ejbql.EJBQLExc
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.map.ObjAttribute;
-import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.EntityResultSegment;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.ScalarResultSegment;
 import org.apache.cayenne.reflect.ClassDescriptor;
-import org.apache.cayenne.util.CayenneMapEntry;
 
 /**
  * A context used for translating of EJBQL to SQL.
@@ -146,9 +142,9 @@ public class EJBQLTranslationContext {
     }
 
     List<DbRelationship> getIncomingRelationships(EJBQLTableId id) {
-        String resolvedEntityId = resolveId(id.getEntityId());
+
         List<DbRelationship> incoming = compiledExpression
-                .getIncomingRelationships(resolvedEntityId);
+                .getIncomingRelationships(resolveId(id.getEntityId()));
 
         // append tail of flattened relationships...
         if (id.getDbPath() != null) {
@@ -172,39 +168,6 @@ public class EJBQLTranslationContext {
             while (it.hasNext()) {
                 incoming.add((DbRelationship) it.next());
             }
-        } else {
-            // Check for vertical inheritance relationships
-            ClassDescriptor descriptor = compiledExpression.getEntityDescriptor(
-                    resolvedEntityId);
-            ObjEntity entity = descriptor.getEntity();
-            Collection<ObjAttribute> entityAttributes = entity.getDeclaredAttributes();
-            // Iterate over entity declared attributes, check for flattened attributes
-            for (ObjAttribute entityAttribute : entityAttributes) {
-                Iterator<CayenneMapEntry> entityAttributeDbPathIterator =
-                    entityAttribute.getDbPathIterator();
-                ArrayList<DbRelationship> entityAttributeDbPathRelationships =
-                    new ArrayList<DbRelationship>();
-                // Collect DB path relationships into list
-                while (entityAttributeDbPathIterator.hasNext()) {
-                    Object entityAttributeDbObject = entityAttributeDbPathIterator.next();
-                    if (entityAttributeDbObject instanceof DbRelationship) {
-                        entityAttributeDbPathRelationships.add((DbRelationship)
-                                entityAttributeDbObject);
-                    }
-                }
-                // Check attribute last DB relationship target entity
-                if (entityAttributeDbPathRelationships.size() > 0 &&
-                        !entityAttributeDbPathRelationships.get(
-                                entityAttributeDbPathRelationships.size() - 1)
-                                .getTargetEntityName().equals(id.getEntityId())) {
-                    // Entity attribute last DB relationship target is flattened vertical
-                    // inheritance attribute, so add its relationships to incoming
-                    // relationships
-                    incoming = new ArrayList<DbRelationship>(incoming);
-                    incoming.addAll(entityAttributeDbPathRelationships);
-                    break;
-                }
-            }
         }
 
         return incoming;
@@ -383,6 +346,7 @@ public class EJBQLTranslationContext {
      * such alias hasn't been used, it is created on the fly.
      */
     protected String getTableAlias(String idPath, String tableName) {
+
         if (!isUsingAliases()) {
             return tableName;
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/VerticalInheritanceTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/VerticalInheritanceTest.java?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/VerticalInheritanceTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/VerticalInheritanceTest.java
Sun Jul 24 11:07:46 2011
@@ -24,14 +24,11 @@ import java.util.Map;
 
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.inheritance.vertical.Iv1Root;
 import org.apache.cayenne.testdo.inheritance.vertical.Iv1Sub1;
-import org.apache.cayenne.testdo.inheritance.vertical.Iv2Sub1;
-import org.apache.cayenne.testdo.inheritance.vertical.Iv2Sub2;
 import org.apache.cayenne.testdo.inheritance.vertical.IvRoot;
 import org.apache.cayenne.testdo.inheritance.vertical.IvSub1;
 import org.apache.cayenne.testdo.inheritance.vertical.IvSub1Sub1;
@@ -58,11 +55,6 @@ public class VerticalInheritanceTest ext
 
         dbHelper.deleteAll("IV1_SUB1");
         dbHelper.deleteAll("IV1_ROOT");
-
-        dbHelper.deleteAll("IV2_SUB1_TO_IV2_SUB2");
-        dbHelper.deleteAll("IV2_SUB2");
-        dbHelper.deleteAll("IV2_SUB1");
-        dbHelper.deleteAll("IV2_ROOT");
     }
 
     public void testInsert_Root() throws Exception {
@@ -494,262 +486,4 @@ public class VerticalInheritanceTest ext
         assertEquals("xSUB1", sub1.getName());
     }
 
-    public void testEjbqlQuery_AttributeOverrides() throws Exception {
-
-        TableHelper iv1RootTable = new TableHelper(dbHelper, "IV1_ROOT");
-        iv1RootTable.setColumns("ID", "NAME", "DISCRIMINATOR");
-
-        TableHelper iv1Sub1Table = new TableHelper(dbHelper, "IV1_SUB1");
-        iv1Sub1Table.setColumns("ID", "SUB1_NAME");
-
-        // insert
-        iv1RootTable.insert(1, "xROOT", null);
-        iv1RootTable.insert(2, "xSUB1_ROOT", "Iv1Sub1");
-        iv1Sub1Table.insert(2, "xSUB1");
-
-        EJBQLQuery query = new EJBQLQuery("SELECT iv1root FROM Iv1Root iv1root");
-        List<Iv1Root> results = context.performQuery(query);
-
-        assertEquals(2, results.size());
-
-        Map<String, Iv1Root> resultTypes = new HashMap<String, Iv1Root>();
-
-        for (Iv1Root result : results) {
-            resultTypes.put(result.getClass().getName(), result);
-        }
-
-        assertEquals(2, resultTypes.size());
-
-        Iv1Root root = resultTypes.get(Iv1Root.class.getName());
-        assertNotNull(root);
-        assertEquals("xROOT", root.getName());
-        assertNull(root.getDiscriminator());
-
-        Iv1Sub1 sub1 = (Iv1Sub1) resultTypes.get(Iv1Sub1.class.getName());
-        assertNotNull(sub1);
-        assertEquals("xSUB1", sub1.getName());
-    }
-
-    public void testEjbqlQuery_SuperSub() 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");
-
-        // insert
-        ivRootTable.insert(1, "xROOT", null);
-        ivRootTable.insert(2, "xSUB1_ROOT", "IvSub1");
-        ivSub1Table.insert(2, "xSUB1");
-
-        EJBQLQuery query = new EJBQLQuery("SELECT ivroot FROM IvRoot ivroot");
-        List<IvRoot> results = context.performQuery(query);
-
-        assertEquals(2, results.size());
-
-        Map<String, IvRoot> resultTypes = new HashMap<String, IvRoot>();
-
-        for (IvRoot result : results) {
-            resultTypes.put(result.getClass().getName(), result);
-        }
-
-        assertEquals(2, resultTypes.size());
-
-        IvRoot root = resultTypes.get(IvRoot.class.getName());
-        assertNotNull(root);
-        assertEquals("xROOT", root.getName());
-        assertNull(root.getDiscriminator());
-
-        IvSub1 sub1 = (IvSub1) resultTypes.get(IvSub1.class.getName());
-        assertNotNull(sub1);
-        assertEquals("xSUB1_ROOT", sub1.getName());
-        assertEquals("IvSub1", sub1.getDiscriminator());
-    }
-
-    public void testEjbqlQuery_MiddleLeaf() 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_NAME");
-
-        TableHelper ivSub1Sub1Table = new TableHelper(dbHelper, "IV_SUB1_SUB1");
-        ivSub1Sub1Table.setColumns("ID", "SUB1_SUB1_NAME");
-
-        // insert
-        ivRootTable.insert(1, "xROOT", null);
-
-        ivRootTable.insert(2, "xSUB1_ROOT", "IvSub1");
-        ivSub1Table.insert(2, "xSUB1");
-
-        ivRootTable.insert(3, "xSUB1_SUB1_ROOT", "IvSub1Sub1");
-        ivSub1Table.insert(3, "xSUB1_SUB1_SUBROOT");
-        ivSub1Sub1Table.insert(3, "xSUB1_SUB1");
-
-        ivRootTable.insert(4, "xROOT_SUB2", "IvSub2");
-        ivSub2Table.insert(4, "xSUB2");
-
-        EJBQLQuery query = new EJBQLQuery("SELECT DISTINCT ivsub1 FROM IvSub1 ivsub1");
-        List<IvRoot> results = context.performQuery(query);
-
-        assertEquals(2, results.size());
-
-        Map<String, IvRoot> resultTypes = new HashMap<String, IvRoot>();
-
-        for (IvRoot result : results) {
-            resultTypes.put(result.getClass().getName(), result);
-        }
-
-        assertEquals(2, resultTypes.size());
-
-        IvSub1 sub1 = (IvSub1) resultTypes.get(IvSub1.class.getName());
-        assertNotNull(sub1);
-        assertEquals("xSUB1_ROOT", sub1.getName());
-        assertEquals("IvSub1", sub1.getDiscriminator());
-
-        IvSub1Sub1 sub1Sub1 = (IvSub1Sub1) resultTypes.get(IvSub1Sub1.class.getName());
-        assertNotNull(sub1Sub1);
-        assertEquals("xSUB1_SUB1_ROOT", sub1Sub1.getName());
-        assertEquals("IvSub1Sub1", sub1Sub1.getDiscriminator());
-        assertEquals("xSUB1_SUB1_SUBROOT", sub1Sub1.getSub1Name());
-        assertEquals("xSUB1_SUB1", sub1Sub1.getSub1Sub1Name());
-    }
-
-    public void testEjbqlQuery_DeepAndWide() 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_NAME");
-
-        TableHelper ivSub1Sub1Table = new TableHelper(dbHelper, "IV_SUB1_SUB1");
-        ivSub1Sub1Table.setColumns("ID", "SUB1_SUB1_NAME");
-
-        // insert
-        ivRootTable.insert(1, "xROOT", null);
-
-        ivRootTable.insert(2, "xSUB1_ROOT", "IvSub1");
-        ivSub1Table.insert(2, "xSUB1");
-
-        ivRootTable.insert(3, "xSUB1_SUB1_ROOT", "IvSub1Sub1");
-        ivSub1Table.insert(3, "xSUB1_SUB1_SUBROOT");
-        ivSub1Sub1Table.insert(3, "xSUB1_SUB1");
-
-        ivRootTable.insert(4, "xROOT_SUB2", "IvSub2");
-        ivSub2Table.insert(4, "xSUB2");
-
-        EJBQLQuery query = new EJBQLQuery("SELECT DISTINCT ivroot FROM IvRoot ivroot");
-        List<IvRoot> results = context.performQuery(query);
-
-        assertEquals(4, results.size());
-
-        Map<String, IvRoot> resultTypes = new HashMap<String, IvRoot>();
-
-        for (IvRoot result : results) {
-            resultTypes.put(result.getClass().getName(), result);
-        }
-
-        assertEquals(4, resultTypes.size());
-
-        IvRoot root = resultTypes.get(IvRoot.class.getName());
-        assertNotNull(root);
-        assertEquals("xROOT", root.getName());
-        assertNull(root.getDiscriminator());
-
-        IvSub1 sub1 = (IvSub1) resultTypes.get(IvSub1.class.getName());
-        assertNotNull(sub1);
-        assertEquals("xSUB1_ROOT", sub1.getName());
-        assertEquals("IvSub1", sub1.getDiscriminator());
-
-        IvSub1Sub1 sub1Sub1 = (IvSub1Sub1) resultTypes.get(IvSub1Sub1.class.getName());
-        assertNotNull(sub1Sub1);
-        assertEquals("xSUB1_SUB1_ROOT", sub1Sub1.getName());
-        assertEquals("IvSub1Sub1", sub1Sub1.getDiscriminator());
-        assertEquals("xSUB1_SUB1_SUBROOT", sub1Sub1.getSub1Name());
-        assertEquals("xSUB1_SUB1", sub1Sub1.getSub1Sub1Name());
-
-        IvSub2 sub2 = (IvSub2) resultTypes.get(IvSub2.class.getName());
-        assertNotNull(sub2);
-        assertEquals("xROOT_SUB2", sub2.getName());
-        assertEquals("IvSub2", sub2.getDiscriminator());
-        assertEquals("xSUB2", sub2.getSub2Name());
-    }
-
-    public void testEjbqlQuery_Flattened() throws Exception {
-
-        TableHelper ivRootTable = new TableHelper(dbHelper, "IV2_ROOT");
-        ivRootTable.setColumns("ID", "NAME", "DISCRIMINATOR");
-
-        TableHelper ivSub1Table = new TableHelper(dbHelper, "IV2_SUB1");
-        ivSub1Table.setColumns("ID", "SUB1_NAME");
-
-        TableHelper ivSub2Table = new TableHelper(dbHelper, "IV2_SUB2");
-        ivSub2Table.setColumns("ID", "SUB2_NAME", "SUB2_ATTR");
-
-        TableHelper ivSub1ToSub2Table = new TableHelper(dbHelper, "IV2_SUB1_TO_IV2_SUB2");
-        ivSub1ToSub2Table.setColumns("ID", "SUB1_ID", "SUB2_ID");
-
-        // insert
-        ivRootTable.insert(1, "xROOT", null);
-
-        ivRootTable.insert(2, "xSUB1_ROOT", "Iv2Sub1");
-        ivSub1Table.insert(2, "xSUB1");
-
-        ivRootTable.insert(3, "xSUB2_ROOT", "Iv2Sub2");
-        ivSub2Table.insert(3, "xSUB2", "ySUB2");
-
-        ivSub1ToSub2Table.insert(1, 2, 3);
-
-        EJBQLQuery query = new EJBQLQuery("SELECT DISTINCT s1 FROM Iv2Sub1 s1 JOIN " +
-        		"s1.iv2sub2s s2 WHERE s2.sub2Attr = 'ySUB2'");
-        List<Iv2Sub1> results = context.performQuery(query);
-
-        assertEquals(1, results.size());
-
-        Iv2Sub1 sub1 = results.get(0);
-        assertNotNull(sub1);
-        assertEquals("xSUB1", sub1.getName());
-        assertEquals("Iv2Sub1", sub1.getDiscriminator());
-
-        List<Iv2Sub2> sub2s = sub1.getIv2sub2s();
-        assertNotNull(sub2s);
-        assertEquals(1, sub2s.size());
-
-        Iv2Sub2 sub2 = sub2s.get(0);
-        assertNotNull(sub2);
-        assertEquals("xSUB2", sub2.getName());
-        assertEquals("Iv2Sub2", sub2.getDiscriminator());
-        assertEquals("ySUB2", sub2.getSub2Attr());
-
-        query = new EJBQLQuery("SELECT COUNT(DISTINCT s1) FROM Iv2Sub1 s1 JOIN " +
-            "s1.iv2sub2s s2 WHERE s2.sub2Attr = 'ySUB2'");
-        List<?> countResult = context.performQuery(query);
-
-        assertEquals(1, countResult.size());
-
-        Long count = (Long) countResult.get(0);
-
-        assertEquals(1, count.longValue());
-
-        query = new EJBQLQuery("SELECT DISTINCT s1 FROM Iv2Sub1 s1 JOIN " +
-            "s1.iv2sub2s s2 WHERE s2 = :sub2");
-        query.setParameter("sub2", sub2);
-        results = context.performQuery(query);
-
-        assertEquals(1, results.size());
-
-        sub1 = results.get(0);
-        assertNotNull(sub1);
-        assertEquals("xSUB1", sub1.getName());
-        assertEquals("Iv2Sub1", sub1.getDiscriminator());
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-vertical.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-vertical.map.xml?rev=1150338&r1=1150337&r2=1150338&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-vertical.map.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-vertical.map.xml
Sun Jul 24 11:07:46 2011
@@ -13,25 +13,6 @@
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 		<db-attribute name="SUB1_NAME" type="VARCHAR" length="100"/>
 	</db-entity>
-	<db-entity name="IV2_ROOT">
-		<db-attribute name="DISCRIMINATOR" type="VARCHAR" length="10"/>
-		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="NAME" type="VARCHAR" length="100"/>
-	</db-entity>
-	<db-entity name="IV2_SUB1">
-		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="SUB1_NAME" type="VARCHAR" length="100"/>
-	</db-entity>
-	<db-entity name="IV2_SUB1_TO_IV2_SUB2">
-		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="SUB1_ID" type="INTEGER" isMandatory="true"/>
-		<db-attribute name="SUB2_ID" type="INTEGER" isMandatory="true"/>
-	</db-entity>
-	<db-entity name="IV2_SUB2">
-		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="SUB2_ATTR" type="VARCHAR" length="100"/>
-		<db-attribute name="SUB2_NAME" type="VARCHAR" length="100"/>
-	</db-entity>
 	<db-entity name="IV_ROOT">
 		<db-attribute name="DISCRIMINATOR" type="VARCHAR" length="10"/>
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
@@ -59,20 +40,6 @@
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="sub1.SUB1_NAME"/>
 		<attribute-override name="name" db-attribute-path="sub1.SUB1_NAME"/>
 	</obj-entity>
-	<obj-entity name="Iv2Root" className="org.apache.cayenne.testdo.inheritance.vertical.Iv2Root"
dbEntityName="IV2_ROOT">
-		<obj-attribute name="discriminator" type="java.lang.String" db-attribute-path="DISCRIMINATOR"/>
-		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
-	</obj-entity>
-	<obj-entity name="Iv2Sub1" superEntityName="Iv2Root" className="org.apache.cayenne.testdo.inheritance.vertical.Iv2Sub1"
dbEntityName="IV2_ROOT">
-		<qualifier><![CDATA[discriminator = "Iv2Sub1"]]></qualifier>
-		<attribute-override name="name" db-attribute-path="sub1.SUB1_NAME"/>
-	</obj-entity>
-	<obj-entity name="Iv2Sub2" superEntityName="Iv2Root" className="org.apache.cayenne.testdo.inheritance.vertical.Iv2Sub2"
dbEntityName="IV2_ROOT">
-		<qualifier><![CDATA[discriminator = "Iv2Sub2"]]></qualifier>
-		<obj-attribute name="name" type="java.lang.String" db-attribute-path="sub2.SUB2_NAME"/>
-		<obj-attribute name="sub2Attr" type="java.lang.String" db-attribute-path="sub2.SUB2_ATTR"/>
-		<attribute-override name="name" db-attribute-path="sub2.SUB2_NAME"/>
-	</obj-entity>
 	<obj-entity name="IvRoot" className="org.apache.cayenne.testdo.inheritance.vertical.IvRoot"
dbEntityName="IV_ROOT">
 		<obj-attribute name="discriminator" type="java.lang.String" db-attribute-path="DISCRIMINATOR"/>
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
@@ -99,30 +66,6 @@
 	<db-relationship name="root" source="IV1_SUB1" target="IV1_ROOT" toMany="false">
 		<db-attribute-pair source="ID" target="ID"/>
 	</db-relationship>
-	<db-relationship name="sub1" source="IV2_ROOT" target="IV2_SUB1" toDependentPK="true"
toMany="false">
-		<db-attribute-pair source="ID" target="ID"/>
-	</db-relationship>
-	<db-relationship name="sub1s" source="IV2_ROOT" target="IV2_SUB1_TO_IV2_SUB2" toMany="true">
-		<db-attribute-pair source="ID" target="SUB1_ID"/>
-	</db-relationship>
-	<db-relationship name="sub2" source="IV2_ROOT" target="IV2_SUB2" toDependentPK="true"
toMany="false">
-		<db-attribute-pair source="ID" target="ID"/>
-	</db-relationship>
-	<db-relationship name="sub2s" source="IV2_ROOT" target="IV2_SUB1_TO_IV2_SUB2" toMany="true">
-		<db-attribute-pair source="ID" target="SUB2_ID"/>
-	</db-relationship>
-	<db-relationship name="root" source="IV2_SUB1" target="IV2_ROOT" toMany="false">
-		<db-attribute-pair source="ID" target="ID"/>
-	</db-relationship>
-	<db-relationship name="to_sub1_id" source="IV2_SUB1_TO_IV2_SUB2" target="IV2_ROOT" toMany="false">
-		<db-attribute-pair source="SUB1_ID" target="ID"/>
-	</db-relationship>
-	<db-relationship name="to_sub2_id" source="IV2_SUB1_TO_IV2_SUB2" target="IV2_ROOT" toMany="false">
-		<db-attribute-pair source="SUB2_ID" target="ID"/>
-	</db-relationship>
-	<db-relationship name="root" source="IV2_SUB2" target="IV2_ROOT" toMany="false">
-		<db-attribute-pair source="ID" target="ID"/>
-	</db-relationship>
 	<db-relationship name="sub1" source="IV_ROOT" target="IV_SUB1" toDependentPK="true" toMany="false">
 		<db-attribute-pair source="ID" target="ID"/>
 	</db-relationship>
@@ -141,5 +84,4 @@
 	<db-relationship name="master" source="IV_SUB2" target="IV_ROOT" toMany="false">
 		<db-attribute-pair source="ID" target="ID"/>
 	</db-relationship>
-	<obj-relationship name="iv2sub2s" source="Iv2Sub1" target="Iv2Sub2" deleteRule="Nullify"
db-relationship-path="sub1s.to_sub2_id"/>
 </data-map>



Mime
View raw message