cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r719367 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect: PersistentDescriptor.java PersistentDescriptorFactory.java
Date Thu, 20 Nov 2008 20:38:35 GMT
Author: aadamchik
Date: Thu Nov 20 12:38:35 2008
New Revision: 719367

URL: http://svn.apache.org/viewvc?rev=719367&view=rev
Log:
CAY-795 Horizontal Inheritance

fixing getRootDbEntities for cases of single table inheritance

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java?rev=719367&r1=719366&r2=719367&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptor.java
Thu Nov 20 12:38:35 2008
@@ -75,6 +75,8 @@
         this.declaredProperties = new HashMap<String, Property>();
         this.superProperties = new HashMap<String, Property>();
         this.subclassDescriptors = new HashMap<String, ClassDescriptor>();
+
+        // must be a set as duplicate addition attempts are expected...
         this.rootDbEntities = new HashSet<DbEntity>(1);
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java?rev=719367&r1=719366&r2=719367&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
Thu Nov 20 12:38:35 2008
@@ -237,18 +237,12 @@
     private void appendDeclaredRootDbEntity(
             PersistentDescriptor descriptor,
             ObjEntity entity) {
-        // since we don't want the entity to look up its super DbEntity (which is
-        // already registered), lookup DbEntity ourselves by name
-        String dbEntityName = entity.getDbEntityName();
-        if (dbEntityName != null) {
-
-            DbEntity dbEntity = entity.getDataMap().getDbEntity(dbEntityName);
-            if (dbEntity != null) {
-
-                // descriptor takes care of weeding off duplicates, although the duplicate
-                // here is highly unlikely
-                descriptor.addRootDbEntity(dbEntity);
-            }
+
+        DbEntity dbEntity = entity.getDbEntity();
+        if (dbEntity != null) {
+            // descriptor takes care of weeding off duplicates, which are likely in cases
+            // of non-horizontal inheritance
+            descriptor.addRootDbEntity(dbEntity);
         }
     }
 



Mime
View raw message