OPENJPA-967: remove duplicate column in the associate

table when MapKey is specified.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@754773 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fay Wang 2009-03-15 22:04:03 +00:00
parent 2860368801
commit 44ffbd2f79
1 changed files with 8 additions and 2 deletions

View File

@ -25,7 +25,6 @@ import org.apache.openjpa.enhance.PersistenceCapable;
import org.apache.openjpa.enhance.Reflection; import org.apache.openjpa.enhance.Reflection;
import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration; import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
import org.apache.openjpa.jdbc.kernel.JDBCStore; import org.apache.openjpa.jdbc.kernel.JDBCStore;
import org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy;
import org.apache.openjpa.jdbc.meta.strats.NoneFieldStrategy; import org.apache.openjpa.jdbc.meta.strats.NoneFieldStrategy;
import org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy; import org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy;
import org.apache.openjpa.jdbc.schema.Column; import org.apache.openjpa.jdbc.schema.Column;
@ -53,7 +52,6 @@ import org.apache.openjpa.util.ApplicationIds;
import org.apache.openjpa.util.InternalException; import org.apache.openjpa.util.InternalException;
import org.apache.openjpa.util.MetaDataException; import org.apache.openjpa.util.MetaDataException;
import org.apache.openjpa.util.ObjectId; import org.apache.openjpa.util.ObjectId;
import org.apache.openjpa.util.OpenJPAId;
/** /**
* Specialization of metadata for relational databases. * Specialization of metadata for relational databases.
@ -160,6 +158,14 @@ public class FieldMapping
if (meta != null) if (meta != null)
return meta.getTable(); return meta.getTable();
} }
ValueMappingImpl vm = (ValueMappingImpl)getDefiningMapping().
getEmbeddingMetaData();
if (vm != null && vm.getValueMappedBy() != null) {
return vm.getFieldMapping().getElementMapping().
getDeclaredTypeMapping().getTable();
}
return getDefiningMapping().getTable(); return getDefiningMapping().getTable();
} }