for (Iterator it = m_uniqueKeys.iterator(); it.hasNext(); ) { Property[] props = (Property[]) it.next(); Column[] cols = new Column[props.length]; for (int i = 0; i < props.length; i++) { cols[i] = props[i].getKeyColumn(); if (cols[i] == null) { props[i].error( "Cannot apply unique constraint to this column." ); } }  Table table = cols[0].getTable();  if (table.getUniqueKey(cols) == null) { new UniqueKey(table, null, cols); } }
    void generateUniqueKeys() {        if (m_referenceKey == null) {            List keyCols = new ArrayList();            boolean mdsql = true;            for (Iterator it = getKeyProperties(); it.hasNext(); ) {                Property prop = (Property) it.next();                Column col = prop.getColumn();                if (col == null) {                    // Not MDSQL enabled, can't generate key                    mdsql = false;                } else {                    keyCols.add(col);                }            }            if (mdsql) {                Column[] cols = (Column[]) keyCols.toArray(new Column[0]);                if (cols.length > 0) {                    Table table = cols[0].getTable();                    for (int i = 0; i < cols.length; i++) {                        if (cols[i].getTable() != table) {                            error("Not all key columns are from the " +                                  "same table.");                        }                    }                    if (table.getPrimaryKey() == null) {                        table.setPrimaryKey(new UniqueKey(table, null, cols));                    }                }            }        } else {            Table table = m_referenceKey.getTable();            if (table.getPrimaryKey() == null) {                table.setPrimaryKey(new UniqueKey(null, m_referenceKey));            }        }        for (Iterator it = getJoinPaths(); it.hasNext(); ) {            JoinPath jp = (JoinPath) it.next();            if (jp.getPath().size() != 1) {                jp.error("Only length 1 join paths are allowed here.");            }            JoinElement je = jp.getJoinElement(0);            Set keyCols = getKeyColumns();            Column ext = null;            if (keyCols.contains(je.getFrom())) {                ext = je.getTo();            } else if (keyCols.contains(je.getTo())) {                ext = je.getFrom();            } else {                jp.error("Join path must join key column of object " +                         "type with extension table.");            }            Table table = ext.getTable();            if (table.getPrimaryKey() == null) {                table.setPrimaryKey(new UniqueKey(null, ext));            }        }    }