in grails-datastore-gorm-hibernate/src/main/groovy/org/grails/orm/hibernate/cfg/HibernateMappingContext.java [128:172]
private static boolean doIsDomainClassCheck(Class<?> clazz) {
if(GormEntity.class.isAssignableFrom(clazz)) {
return true;
}
// it's not a closure
if (Closure.class.isAssignableFrom(clazz)) {
return false;
}
if (clazz.isEnum()) return false;
Annotation[] allAnnotations = clazz.getAnnotations();
for (Annotation annotation : allAnnotations) {
Class<? extends Annotation> type = annotation.annotationType();
String annName = type.getName();
if (annName.equals("grails.persistence.Entity")) {
return true;
}
if (type.equals(Entity.class)) {
return true;
}
}
Class<?> testClass = clazz;
while (testClass != null && !testClass.equals(GroovyObject.class) && !testClass.equals(Object.class)) {
try {
// make sure the identify and version field exist
testClass.getDeclaredField(GormProperties.IDENTITY);
testClass.getDeclaredField(GormProperties.VERSION);
// passes all conditions return true
return true;
}
catch (SecurityException e) {
// ignore
}
catch (NoSuchFieldException e) {
// ignore
}
testClass = testClass.getSuperclass();
}
return false;
}