* accessor is found and this descriptor represents an inheritance subclass,
* then traverse up the chain to look for that accessor. Null is returned
* otherwise.
*/
protected MappingAccessor getMappingAccessor(String fieldOrPropertyName, boolean checkForMethodName) {
MappingAccessor accessor = m_mappingAccessors.get(fieldOrPropertyName);
if (accessor == null) {
// Perhaps we have a method name. This is value add, and maybe we
// really shouldn't do this but it covers the following case:
// <order-by>age, getGender DESC</order-by>, where the user
// specifies a method name.
if (checkForMethodName) {
accessor = m_mappingAccessors.get(Helper.getAttributeNameFromMethodName(fieldOrPropertyName));
}
// If still no accessor and we are an inheritance subclass, check
// our parent descriptor. Unless we are within a table per class
// strategy in which case, if the mapping doesn't exist within our
// accessor list, we don't want to deal with it.
if (accessor == null && isInheritanceSubclass() && ! usesTablePerClassInheritanceStrategy()) {
accessor = getInheritanceParentDescriptor().getMappingAccessor(fieldOrPropertyName, checkForMethodName);
}
}
if (accessor == null) {
// Traverse any dot notation (nested embeddables) if specified.
if (fieldOrPropertyName.contains(".")) {
String attributeName = fieldOrPropertyName.substring(0, fieldOrPropertyName.indexOf("."));
String subAttributeName = fieldOrPropertyName.substring(fieldOrPropertyName.indexOf(".") + 1);
MappingAccessor embeddedAccessor = m_mappingAccessors.get(attributeName);
if (embeddedAccessor != null) {
accessor = embeddedAccessor.getReferenceDescriptor().getMappingAccessor(subAttributeName, checkForMethodName);
}
}
// If we are still null, maybe the user has not used a dot notation
// that is, has not been fully specific. At this point this is value