openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r429477 - /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
Date Mon, 07 Aug 2006 21:02:31 GMT
Author: awhite
Date: Mon Aug  7 14:02:31 2006
New Revision: 429477

URL: http://svn.apache.org/viewvc?rev=429477&view=rev
Log: (empty)

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

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java?rev=429477&r1=429476&r2=429477&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingRepository.java
Mon Aug  7 14:02:31 2006
@@ -791,6 +791,12 @@
             case JavaTypes.ARRAY:
             case JavaTypes.COLLECTION:
                 ValueMapping elem = field.getElementMapping();
+                ValueHandler ehandler = namedHandler(elem);
+                if (ehandler == null)
+                    ehandler = defaultHandler(elem);
+                if (ehandler != null)
+                    return handlerCollectionStrategy(field, ehandler, 
+                        installHandlers);
                 if (elem.getTypeCode() == JavaTypes.PC
                     && !elem.isSerialized() && !elem.isEmbeddedPC()) {
                     if (useInverseKeyMapping(field))
@@ -800,18 +806,50 @@
                 break;
             case JavaTypes.MAP:
                 ValueMapping key = field.getKeyMapping();
+                ValueHandler khandler = namedHandler(key);
+                if (khandler == null)
+                    khandler = defaultHandler(key);
                 ValueMapping val = field.getElementMapping();
-                boolean krel = key.getTypeCode() == JavaTypes.PC
+                ValueHandler vhandler = namedHandler(val);
+                if (vhandler == null)
+                    vhandler = defaultHandler(val);
+                boolean krel = khandler == null 
+                    && key.getTypeCode() == JavaTypes.PC
                     && !key.isSerialized() && !key.isEmbeddedPC();
-                boolean vrel = val.getTypeCode() == JavaTypes.PC
+                boolean vrel = vhandler == null 
+                    && val.getTypeCode() == JavaTypes.PC
                     && !val.isSerialized() && !val.isEmbeddedPC();
                 if (!krel && vrel && key.getValueMappedBy() != null) {
                     if (useInverseKeyMapping(field))
                         return new RelationMapInverseKeyFieldStrategy();
                     return new RelationMapTableFieldStrategy();
                 }
-                break;
+                if (!krel && khandler == null)
+                    break;
+                if (!vrel && vhandler == null)
+                    break;
+                return handlerMapStrategy(field, khandler, vhandler, krel,
+                    vrel, installHandlers);
         }
+        return null;
+    }
+
+    /**
+     * Return the collection strategy for the given element handler, or null
+     * if none.
+     */
+    protected FieldStrategy handlerCollectionStrategy(FieldMapping field, 
+        ValueHandler ehandler, boolean installHandlers) {
+        return null;
+    }
+
+    /**
+     * Return the map strategy for the given key and value handlers / relations,
+     * or null if none.
+     */
+    protected FieldStrategy handlerMapStrategy(FieldMapping field, 
+        ValueHandler khandler, ValueHandler vhandler, boolean krel, 
+        boolean vrel,  boolean installHandlers) {
         return null;
     }
 



Mime
View raw message