for (int index = (allMappings.size() - 1); index >= 0; --index) {
DatabaseMapping mapping = (DatabaseMapping) allMappings.get(index);
// So here is the ugly check to see if we want to further look at this mapping as part of
// the id or not.
if (aDescriptor.hasDerivedId() && ! mapping.derivesId()) {
// If the mapping is not a derived id, then we need to keep looking for the mapping that
// is marked as the derived id mapping. However, in a mapped by id case, we may have
// 'extra' non-derived id fields within the embeddable class (and the writable mapping
// that we care about at this point will be defined on the embeddable descriptor). Therefore,
// we can't bail at this point and must drill down further into the embeddable to make sure