// if (column.isPrimaryKey() && !table.isManyToMany()) return null;
// String tablename = getTargetEntityName(column);
// Table target = TableUtils.getTable(table.getDatabase(), tablename);
// if (target == null)
// target = TableUtils.getTableFromAlias(table.getDatabase(), tablename);
Table target = getTarget(column);
if (target != null) {
Field f = new Field();
f.setName(column.getName());
f.setLinkToTargetEntity(target.getName());
f.setLinkToTargetField(TableUtils.getPrimaryKey(target));
Entity entity = new Entity();
entity.setName(table.getName());
f.setEntity(entity);
f.setBidirectional("true");