private void addIndex(IndexDescriptorDef indexDescDef, TableDef tableDef)
    {
        IndexDef indexDef = tableDef.getIndex(indexDescDef.getName());

        if (indexDef == null)
        {
            indexDef = new IndexDef(indexDescDef.getName(),
                                    indexDescDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_UNIQUE, false));
            tableDef.addIndex(indexDef);
        }

        try
        {
            String             fieldNames = indexDescDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS);
            ArrayList          fields     = ((ClassDescriptorDef)indexDescDef.getOwner()).getFields(fieldNames);
            FieldDescriptorDef fieldDef;

            for (Iterator it = fields.iterator(); it.hasNext();)
            {
                fieldDef = (FieldDescriptorDef)it.next();
                indexDef.addColumn(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN));
            }
        }
        catch (NoSuchFieldException ex)
        {
            // won't happen if we already checked the constraints
        }
    }
private void addIndex ( IndexDescriptorDef indexDescDef , TableDef tableDef ) { IndexDef indexDef = tableDef . getIndex ( indexDescDef . getName ( ) ) ; if ( indexDef == null ) { indexDef = new IndexDef ( indexDescDef . getName ( ) , indexDescDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_UNIQUE , false ) ) ; tableDef . addIndex ( indexDef ) ; } try { String fieldNames = indexDescDef . getProperty ( PropertyHelper . OJB_PROPERTY_FIELDS ) ; ArrayList fields = ( ( ClassDescriptorDef ) indexDescDef . getOwner ( ) ) . getFields ( fieldNames ) ; FieldDescriptorDef fieldDef ; for ( Iterator it = fields . iterator ( ) ; it . hasNext ( ) ; ) { fieldDef = ( FieldDescriptorDef ) it . next ( ) ; indexDef . addColumn ( fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_COLUMN ) ) ; } } catch ( NoSuchFieldException ex ) { } }
Adds an index to the table for the given index descriptor.

@param indexDescDef The index descriptor
@param tableDef     The table