cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r606472 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
Date Sat, 22 Dec 2007 17:41:16 GMT
Author: aadamchik
Date: Sat Dec 22 09:41:15 2007
New Revision: 606472

URL: http://svn.apache.org/viewvc?rev=606472&view=rev
Log:
POJO: prevent early resolution of the descriptor for the relationship target that can lead
to an endless loop on startup

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java?rev=606472&r1=606471&r2=606472&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
Sat Dec 22 09:41:15 2007
@@ -75,6 +75,17 @@
     }
 
     public Class<?> getObjectClass() {
+        
+        // note that we can resolve Object class without triggering descriptor resolution.
+        // This is very helpful when compiling POJO relationships
+        if (descriptor == null) {
+
+            ObjEntity entity = descriptorMap.getResolver().getObjEntity(entityName);
+            if (entity != null) {
+                return entity.getJavaClass();
+            }
+        }
+
         checkDescriptorInitialized();
         return descriptor.getObjectClass();
     }
@@ -92,7 +103,7 @@
         checkDescriptorInitialized();
         return descriptor.getIdProperties();
     }
-    
+
     public Iterator<ArcProperty> getMapArcProperties() {
         checkDescriptorInitialized();
         return descriptor.getMapArcProperties();



Mime
View raw message