*/
public Reference [] getChildren() {
if (children == null) {
children = new ArrayList<Reference>();
String columnRef;
Reference ref;
Reference reference;
Table [] tables = database.getEntities();
for (int i = 0; i < tables.length; i++) {
ForeignKey [] fk = tables[i].getForeignKeys();
for (int j = 0; j < fk.length; j++) {
String tableName = fk[j].getForeignTableName();
if (tableName!=null) {
if (tableName.toLowerCase().equals(table.getName().toLowerCase())) {
ref = fk[j].getReference(0);
columnRef = ref.getLocalColumnName();
Column column = ColumnUtils.getColumn (tables[i], ref.getLocalColumnName());
//reference = new Reference(tables[i], column2, tables[i].getName(), ref.getLocalColumnName());
//org.apache.ddlutils.model.ForeignKey foreignKeyddlutils = tables[i].getForeignKeys()[j].getFirstReference();
//org.apache.ddlutils.model.Reference referenceddlutils = foreignKeyddlutils.getFirstReference();
reference = tables[i].getForeignKeys()[j].getFirstReference();
//reference = new ReferenceDDLUtils (new org.apache.ddlutils.model.Reference ());
reference.setForeignColumn(column);
reference.setForeignColumnName(column.getName());
reference.setForeignTable(tables[i]);
reference.setForeignTableName(tables[i].getName());
//ColumnDDLUtils localCol = (ColumnDDLUtils)TableUtils.getPrimaryFirstColumn(new TableDDLUtils(table));
//ColumnDDLUtils columnLoc = new ColumnDDLUtils(localCol, new TableDDLUtils(table));
reference.setLocalColumn(TableUtils.getPrimaryFirstColumn(new TableDDLUtils(table)));
reference.setLocalTable(new TableDDLUtils(table));
//reference.setLocalColumn(localCol);
addReference(children, reference);
}
}