code: private FieldType findForeignFieldType(Class<?> clazz, Class<?> foreignClass, Dao<?, ?> foreignDao)
  			throws SQLException {
  		String foreignColumnName = fieldConfig.getForeignCollectionForeignFieldName();
  		for (FieldType fieldType : foreignDao.getTableInfo().getFieldTypes()) {
  			if (fieldType.getType() == foreignClass
  					&& (foreignColumnName == null || fieldType.getField().getName().equals(foreignColumnName))) {
  				if (!fieldType.fieldConfig.isForeign() && !fieldType.fieldConfig.isForeignAutoRefresh()) {
  					// this may never be reached
  					throw new SQLException("Foreign collection object " + clazz + " for field '" + field.getName()
  							+ "' contains a field of class " + foreignClass + " but it's not foreign");
  				}
  				return fieldType;
  			}
  		}
  		// build our complex error message
  		StringBuilder sb = new StringBuilder();
  		sb.append("Foreign collection class ").append(clazz.getName());
  		sb.append(" for field '").append(field.getName()).append("' column-name does not contain a foreign field");
  		if (foreignColumnName != null) {
  			sb.append(" named '").append(foreignColumnName).append('\'');
  		}
  		sb.append(" of class ").append(foreignClass.getName());
  		throw new SQLException(sb.toString());
  	}
docs: If we have a class Foo with a collection of Bar's then we go through Bar's DAO looking for a Foo field. We need
  this field to build the query that is able to find all Bar's that have foo_id that matches our id.