EOQualifier q = new EOKeyValueQualifier("className", EOQualifier.QualifierOperatorEqual, className);
NSArray candidates = EOQualifier.filteredArrayWithQualifier(entities, q);
if(candidates.count() > 1) {
log.warn("More than one entity found: " + candidates);
}
EOEntity entity = (EOEntity) candidates.lastObject();
if(entity != null) {
String entityName = entity.name();
// HACK AK: this relies on you having set up your classes correctly,
// meaning that you have exactly one final class var per EO class, with the correct
// superclasses set up (so EOBase gets loaded before EOSubclass)