// notation names meaning you will not find their respective mapping
// accessor on the embeddable descriptor.
Map<String, AttributeOverrideMetadata> mergedAttributeOverrides = getAttributeOverrides(attributeOverrides);
for (String attributeName : mergedAttributeOverrides.keySet()) {
AttributeOverrideMetadata attributeOverride = mergedAttributeOverrides.get(attributeName);
// The getMappingForAttributeName call will take care of any sub dot
// notation attribute names when looking for the mapping. It will
// traverse the embeddable chain.
MappingAccessor mappingAccessor = embeddableDescriptor.getMappingAccessor(attributeName);
String colName = attributeOverride.getColumn().getName();
if (colName == null || colName.isEmpty()) {
String prevName = mappingAccessor.getDefaultAttributeName();
attributeOverride.getColumn().setName(prevName);
}
if (mappingAccessor == null) {
throw ValidationException.embeddableAttributeOverrideNotFound(embeddableDescriptor.getJavaClass(), attributeName, getJavaClass(), getAttributeName());
} else if (! mappingAccessor.isBasic()) {
throw ValidationException.invalidEmbeddableAttributeForAttributeOverride(embeddableDescriptor.getJavaClass(), attributeName, getJavaClass(), getAttributeName());
} else {
// Get databasefield() takes care of any delimited/uppercasing on the column.
addFieldNameTranslation(aggregateObjectMapping, attributeName, attributeOverride.getColumn().getDatabaseField(), mappingAccessor);
}
}
}