// The action depends on the type of association (1-N or N-M)
INonTransactionalAction action = null;
AssociatedEntityList ann = f.getAnnotation(AssociatedEntityList.class);
if (ann != null && ann.joinTableName().length() > 0) {
action = new FindExternalRelatedEntitiesAction(entity, f, ann.joinTableName(), detailLevel - 1);
} else {
action = new FindEntitiesAction(query, LMLGlobalOperations.getCollectionType(f), detailLevel - 1, id);
}
// Search the collection and set it into the related attribute