private Property bindOneToOne(PersistentClass rc, Table targetTable,
ForeignKey fk, Set processedColumns, boolean constrained, boolean inverseProperty) {
OneToOne value = new OneToOne(targetTable, rc);
value.setReferencedEntityName(revengStrategy
.tableToClassName(TableIdentifier.create(targetTable)));
boolean isUnique = isUniqueReference(fk);
String propertyName = null;
if(inverseProperty) {
propertyName = revengStrategy.foreignKeyToInverseEntityName(fk.getName(),
TableIdentifier.create(fk.getReferencedTable()), fk
.getReferencedColumns(), TableIdentifier
.create(targetTable), fk.getColumns(), isUnique);
} else {
propertyName = revengStrategy.foreignKeyToEntityName(fk.getName(),
TableIdentifier.create(fk.getReferencedTable()), fk
.getReferencedColumns(), TableIdentifier
.create(targetTable), fk.getColumns(), isUnique);
}
Iterator columns = fk.getColumnIterator();
while (columns.hasNext()) {
Column fkcolumn = (Column) columns.next();
checkColumn(fkcolumn);
value.addColumn(fkcolumn);
processedColumns.add(fkcolumn);
}
value.setFetchMode(FetchMode.SELECT);
value.setConstrained(constrained);
value.setForeignKeyType( constrained ?
ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT :
ForeignKeyDirection.FOREIGN_KEY_TO_PARENT );
return makeEntityProperty(propertyName, true, targetTable, fk, value, inverseProperty);