openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r565896 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java
Date Tue, 14 Aug 2007 20:17:40 GMT
Author: kwsutter
Date: Tue Aug 14 13:17:39 2007
New Revision: 565896

URL: http://svn.apache.org/viewvc?view=rev&rev=565896
Log:
OPENJPA-313.  Looks like this patch wasn't quite ready for prime time.  I attempted to re-build
and re-test right after applying this change and I got several testcase errors in openjpa-persistence-jdbc.
 I revert back ClassMapping.java and the problems go away.  Needs some more work...

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java?view=diff&rev=565896&r1=565895&r2=565896
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMapping.java
Tue Aug 14 13:17:39 2007
@@ -30,7 +30,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.strats.NoneClassStrategy;
@@ -190,33 +189,8 @@
             }
         }
         Object oid = ApplicationIds.fromPKValues(vals, cls);
-        if (oid instanceof OpenJPAId) {
-            Class type = cls.getDescribedType();
-            if (!subs)
-                // non-polymorphic relations
-                ((OpenJPAId) oid).setManagedInstanceType(type);
-            else if (cls.getDiscriminator() != null
-                && !StringUtils.equals("none",
-                    cls.getDiscriminator().getStrategy().getAlias())) {
-                // for polymorphic relations,
-                // the type field in the oid is initially set to base type.
-                // If the discriminator value is preset in the current result,
-                // then the type field needs reset based on discriminator value.
-                // If the discriminator value is not present or invalid,
-                // ignore any exceptions being thrown.
-                // The discriminator value can potentially be null in the 
-                // database because the mapping tool does not enforce the 
-                // discriminator column 'not null'.
-                // We can not prevent other non-jpa applications from inserting
-                // a null or invalid discriminator value.
-                res.startDataRequest(cls.getDiscriminator());
-                try {
-                    type = cls.getDiscriminator().getClass(store, cls, res);
-                    ((OpenJPAId) oid).setManagedInstanceType(type);
-                } catch (Exception e) {}
-                res.endDataRequest();  
-            } 
-        }
+        if (!subs && oid instanceof OpenJPAId)
+            ((OpenJPAId) oid).setManagedInstanceType(cls.getDescribedType());
         return oid;
     }
 



Mime
View raw message