OPENJPA-146 : When copying an OID superclass field for re-mapping, revert type

to PC.  It will re-resolve to OID on its own when the field's metadata is
resolved, and in the meantime it will ensure we use the same path for 
metadata resolution as non-copied fields.



git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@509632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2007-02-20 16:33:54 +00:00
parent 4f102a7c77
commit 1b446958f5
2 changed files with 9 additions and 3 deletions

View File

@ -888,7 +888,8 @@ public class MappingTool
* <ul> * <ul>
* <li>Refresh the mappings for given package, without dropping any * <li>Refresh the mappings for given package, without dropping any
* schema components:<br /> * schema components:<br />
* <code>java org.apache.openjpa.jdbc.meta.MappingTool mypackage.jdo</code></li> * <code>java org.apache.openjpa.jdbc.meta.MappingTool
* mypackage.jdo</code></li>
* <li>Refresh the mappings for all persistent classes in the classpath, * <li>Refresh the mappings for all persistent classes in the classpath,
* dropping any unused columns and even tables:<br /> * dropping any unused columns and even tables:<br />
* <code>java org.apache.openjpa.jdbc.meta.MappingTool -sa refresh * <code>java org.apache.openjpa.jdbc.meta.MappingTool -sa refresh

View File

@ -201,8 +201,8 @@ public class ValueMetaDataImpl
switch (_delete) { switch (_delete) {
case CASCADE_NONE: case CASCADE_NONE:
// if the user marks the owning field dependent and we externalize // if the user marks the owning field dependent and we
// to a pc type, then become dependent // externalize to a pc type, then become dependent
if (this != _owner.getValue() && isTypePC() if (this != _owner.getValue() && isTypePC()
&& ((ValueMetaDataImpl) _owner.getValue())._delete && ((ValueMetaDataImpl) _owner.getValue())._delete
== CASCADE_AUTO) == CASCADE_AUTO)
@ -432,8 +432,13 @@ public class ValueMetaDataImpl
} }
public void copy(ValueMetaData vmd) { public void copy(ValueMetaData vmd) {
// copy declared types, but if OID revert to PC until we resolve
// to OID ourselves
_decType = vmd.getDeclaredType(); _decType = vmd.getDeclaredType();
_decCode = vmd.getDeclaredTypeCode(); _decCode = vmd.getDeclaredTypeCode();
if (_decCode == JavaTypes.OID)
_decCode = JavaTypes.PC;
_delete = vmd.getCascadeDelete(); _delete = vmd.getCascadeDelete();
_persist = vmd.getCascadePersist(); _persist = vmd.getCascadePersist();
_attach = vmd.getCascadeAttach(); _attach = vmd.getCascadeAttach();