openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r639746 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/
Date Fri, 21 Mar 2008 18:23:27 GMT
Author: fancy
Date: Fri Mar 21 11:23:19 2008
New Revision: 639746

URL: http://svn.apache.org/viewvc?rev=639746&view=rev
Log:
OPENJPA-539 Can't create a table with a field of java type "Map" in Derby
commit patch for Fay Wang. 
testcases have been modified.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerRelationMapTableFieldStrategy.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToHandlerMapInstance.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToRelationMapInstance.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java?rev=639746&r1=639745&r2=639746&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerHandlerMapTableFieldStrategy.java
Fri Mar 21 11:23:19 2008
@@ -108,7 +108,10 @@
 
         field.mapJoin(adapt, true);
         _kio = new ColumnIO();
-        _kcols = HandlerStrategies.map(key, "key", _kio, adapt);
+        DBDictionary dict = field.getMappingRepository().getDBDictionary();
+        _kcols = HandlerStrategies.map(key, 
+            dict.getValidColumnName("key", field.getTable()), _kio, adapt);
+
         _vio = new ColumnIO();
         _vcols = HandlerStrategies.map(val, "value", _vio, adapt);
         field.mapPrimaryKey(adapt);

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerRelationMapTableFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerRelationMapTableFieldStrategy.java?rev=639746&r1=639745&r2=639746&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerRelationMapTableFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/HandlerRelationMapTableFieldStrategy.java
Fri Mar 21 11:23:19 2008
@@ -133,7 +133,9 @@
 
         field.mapJoin(adapt, true);
         _kio = new ColumnIO();
-        _kcols = HandlerStrategies.map(key, "key", _kio, adapt);
+        DBDictionary dict = field.getMappingRepository().getDBDictionary();
+        _kcols = HandlerStrategies.map(key, 
+            dict.getValidColumnName("key", field.getTable()), _kio, adapt);
 
         if (val.getTypeMapping().isMapped()) {
             ValueMappingInfo vinfo = val.getValueInfo();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToHandlerMapInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToHandlerMapInstance.java?rev=639746&r1=639745&r2=639746&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToHandlerMapInstance.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToHandlerMapInstance.java
Fri Mar 21 11:23:19 2008
@@ -25,7 +25,6 @@
 
 import org.apache.openjpa.persistence.PersistentMap;
 import org.apache.openjpa.persistence.jdbc.ContainerTable;
-import org.apache.openjpa.persistence.jdbc.KeyColumn;
 
 @Entity
 public class HandlerToHandlerMapInstance {
@@ -34,8 +33,6 @@
 
     @PersistentMap
     @ContainerTable(name="NONSTD_MAPPING_MAP")
-    // needed because we hard-code 'key' in the handler FieldStrategies
-    @KeyColumn(name="key_col") 
     private Map<String,String> map = new HashMap<String,String>();
 
     public Map<String,String> getMap() {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToRelationMapInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToRelationMapInstance.java?rev=639746&r1=639745&r2=639746&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToRelationMapInstance.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/HandlerToRelationMapInstance.java
Fri Mar 21 11:23:19 2008
@@ -25,7 +25,6 @@
 import javax.persistence.Id;
 
 import org.apache.openjpa.persistence.PersistentMap;
-import org.apache.openjpa.persistence.jdbc.KeyColumn;
 import org.apache.openjpa.persistence.simple.AllFieldTypes;
 
 @Entity
@@ -34,8 +33,6 @@
     private int id;
 
     @PersistentMap(elementCascade = CascadeType.PERSIST)
-    // needed because we hard-code 'key' in the handler FieldStrategies
-    @KeyColumn(name="key_col")
     private Map<String,AllFieldTypes> map = new HashMap<String,AllFieldTypes>();
 
     public Map<String,AllFieldTypes> getMap() {



Mime
View raw message