This commit is contained in:
A. Abram White 2006-08-07 21:02:31 +00:00
parent b499aded0d
commit 1e6d57eb55
1 changed files with 41 additions and 3 deletions

View File

@ -791,6 +791,12 @@ public class MappingRepository
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,21 +806,53 @@ public class MappingRepository
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;
}
/**
* Use hints in mapping data to figure out whether the given relation
* field should use an inverse foreign key or an association table mapping.