if (field.getLinkToTargetEntity()!=null && field.getLinkToTargetField()!=null) {
Reference reference = ReferenceUtils.getReference(field, database);
if (reference!=null) {
org.apache.ddlutils.model.ForeignKey foreignKeyMp = new org.apache.ddlutils.model.ForeignKey();
foreignKeyMp.setName(field.getName());
ForeignKey foreignKey = new ForeignKeyDDLUtils (foreignKeyMp);
foreignKey.setForeignTableName(field.getLinkToTargetEntity());
foreignKey.setReference (reference);
// bidirection
if (field.getBidirectional()!=null && field.getBidirectional().equals("false"))
foreignKey.setBidirectional(false);
return foreignKey;
}
logger.info("no correct fk found for "+field.getEntity().getName()+" - "+field.getName()+" - pointing towards "+field.getLinkToTargetEntity()+" - "+field.getLinkToTargetField());
}
return null;