openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r482775 - /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
Date Tue, 05 Dec 2006 20:49:12 GMT
Author: awhite
Date: Tue Dec  5 12:49:11 2006
New Revision: 482775

URL: http://svn.apache.org/viewvc?view=rev&rev=482775
Log:
Default name fix.


Modified:
    incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java

Modified: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java?view=diff&rev=482775&r1=482774&r2=482775
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
Tue Dec  5 12:49:11 2006
@@ -160,18 +160,22 @@
     public void populateForeignKeyColumn(ValueMapping vm, String name,
         Table local, Table foreign, Column col, Object target, boolean inverse,
         int pos, int cols) {
+        boolean elem = vm == vm.getFieldMapping().getElement()
+            && vm.getFieldMapping().getTypeCode() != JavaTypes.MAP;
+
         // if this is a non-inverse collection element key, it must be in
         // a join table: if we're not prepending the field name, leave the
         // default
-        if (!_prependFieldNameToJoinTableInverseJoinColumns && !inverse 
-            && vm == vm.getFieldMapping().getElement()
-            && vm.getFieldMapping().getTypeCode() != JavaTypes.MAP)
+        if (!_prependFieldNameToJoinTableInverseJoinColumns && !inverse &&
elem)
             return;
 
         // otherwise jpa always uses <field>_<pkcol> for column name, even
         // when only one col
-        if (target instanceof Column)
+        if (target instanceof Column) {
+            if (elem)
+                name = vm.getFieldMapping().getName();
             col.setName(name + "_" + ((Column) target).getName());
+        }
     }
 
     @Override



Mime
View raw message