// If the accessor is a relationship accessor than it may or may
// not have been processed yet. Fast track its processing if it
// needs to be. The process call will do nothing if it has already
// been processed.
if (accessor.isRelationship()) {
RelationshipAccessor relationshipAccessor = (RelationshipAccessor) accessor;
// Check that we don't have circular mappedBy values which
// will cause an infinite loop.
if (referencingAccessor != null && (relationshipAccessor.isOneToOne() || relationshipAccessor.isCollectionAccessor())) {
String mappedBy = null;
if (relationshipAccessor.isOneToOne()) {
mappedBy = ((OneToOneAccessor) relationshipAccessor).getMappedBy();
} else {
mappedBy = ((CollectionAccessor) relationshipAccessor).getMappedBy();
}
if (mappedBy != null && mappedBy.equals(referencingAccessor.getAttributeName())) {
throw ValidationException.circularMappedByReferences(referencingAccessor.getJavaClass(), referencingAccessor.getAttributeName(), getJavaClass(), attributeName);
}
}
relationshipAccessor.processRelationship();
}
// Return the mapping from the accessors descriptor since it may
// be our descriptor or a parent descriptor from an inheritance
// hierarchy.