// TODO check auto fields
throw new RuntimeException("OneToOne relations are not implemented yet!");
} else if (field.isAnnotationPresent(OneToMany.class)) {
OneToMany oneToMany = field.getAnnotation(OneToMany.class);
this.checkOrderByAnnotation(field, orderBy);
if (field.getType() != List.class) {
throw new UnsupportedFieldTypeException("The annotated field " + field.getName() + " in " + beanClass + " is of unsupported type "
+ field.getType() + ". Fields annotated as @OneToMany have to be a genericly typed " + List.class, field, OneToMany.class,
beanClass);
}
if (ReflectionUtils.getGenericlyTypeCount(field) != 1) {
throw new UnsupportedFieldTypeException("The annotated field " + field.getName() + " in " + beanClass
+ " is genericly typed. Fields annotated as @OneToMany have to be a genericly typed " + List.class, field, OneToMany.class,
beanClass);
}
// This is a bit ugly but still necessary until someone else
// comes up with something smarter...
Class<?> remoteClass = (Class<?>) ReflectionUtils.getGenericType(field);
SimplifiedRelation simplifiedRelation = field.getAnnotation(SimplifiedRelation.class);
if (simplifiedRelation != null) {
this.oneToManyRelations.put(field, SimplifiedOneToManyRelation.getGenericInstance(beanClass, remoteClass, field, this, typePopulators, queryParameterPopulators));
} else {
// Use this class pks, no extra field
this.oneToManyRelations.put(field, DefaultOneToManyRelation.getGenericInstance(beanClass, remoteClass, field, daoFactory, daoManaged));
}
if (oneToMany.autoAdd()) {
this.autoAddRelations.add(field);
}
if (oneToMany.autoUpdate()) {
this.autoUpdateRelations.add(field);
}
if (oneToMany.autoGet()) {
this.autoGetRelations.add(field);
}
} else if (field.isAnnotationPresent(ManyToOne.class)) {