public void installStrategy(FieldMapping field) {
FieldStrategy strategy = repos.namedStrategy(field, true);
if (strategy == null) {
try {
strategy = repos.defaultStrategy(field, true, false);
} catch (MetaDataException mde) {
// if the parent class is abstract and field is unmapped,
// allow it to pass (assume subclasses map the field)
Class cls = field.getDefiningMetaData().getDescribedType();
if (!Modifier.isAbstract(cls.getModifiers())
|| field.getMappedBy() != null
|| field.getMappingInfo().hasSchemaComponents()
|| field.getValueInfo().hasSchemaComponents()
|| field.getElementMapping().getValueInfo().
hasSchemaComponents()
|| field.getKeyMapping().getValueInfo().
hasSchemaComponents())
throw mde;
strategy = NoneFieldStrategy.getInstance();
}
}
field.setStrategy(strategy, Boolean.FALSE);
}
|