private void checkKeyModifications(ModelDef modelDef, FieldDescriptorDef keyDef) throws ConstraintException
    {
        // we check the field if it changes the primarykey-status or the jdbc-type
        FieldDescriptorDef baseFieldDef    = (FieldDescriptorDef)keyDef.getOriginal();
        boolean            isIgnored       = keyDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false);
        boolean            changesJdbcType = !baseFieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE).equals(keyDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));
        boolean            changesPrimary  = baseFieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY, false) !=
                                             keyDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY, false) ;

        if (isIgnored || changesJdbcType || changesPrimary)
        {
            FeatureDescriptorDef usingFeature = null;

            do
            {    
                usingFeature = usedByReference(modelDef, baseFieldDef);
                if (usingFeature != null)
                {
                    if (isIgnored)
                    {
                        throw new ConstraintException("Cannot ignore field "+keyDef.getName()+" in class "+keyDef.getOwner().getName()+
                                                      " because it is used in class "+baseFieldDef.getOwner().getName()+
                                                      " by the reference "+usingFeature.getName()+" from class "+
                                                      usingFeature.getOwner().getName());
                    }
                    else if (changesJdbcType)
                    {    
                        throw new ConstraintException("Modification of the jdbc-type for the field "+keyDef.getName()+" in class "+
                                                      keyDef.getOwner().getName()+" is not allowed because it is used in class "+
                                                      baseFieldDef.getOwner().getName()+" by the reference "+usingFeature.getName()+
                                                      " from class "+usingFeature.getOwner().getName());
                    }
                    else
                    {
                        throw new ConstraintException("Cannot change the primarykey status of field "+keyDef.getName()+" in class "+
                                                      keyDef.getOwner().getName()+" as primarykeys are used in class "+
                                                      baseFieldDef.getOwner().getName()+" by the reference "+usingFeature.getName()+
                                                      " from class "+usingFeature.getOwner().getName());
                    }
                }

                usingFeature = usedByCollection(modelDef, baseFieldDef, changesPrimary);
                if (usingFeature != null)
                {
                    if (isIgnored)
                    {
                        throw new ConstraintException("Cannot ignore field "+keyDef.getName()+" in class "+keyDef.getOwner().getName()+
                                                      " because it is used in class "+baseFieldDef.getOwner().getName()+
                                                      " as a foreignkey of the collection "+usingFeature.getName()+" from class "+
                                                      usingFeature.getOwner().getName());
                    }
                    else if (changesJdbcType)
                    {    
                        throw new ConstraintException("Modification of the jdbc-type for the field "+keyDef.getName()+" in class "+
                                                      keyDef.getOwner().getName()+" is not allowed because it is used in class "+
                                                      baseFieldDef.getOwner().getName()+" as a foreignkey of the collecton "+
                                                      usingFeature.getName()+" from class "+usingFeature.getOwner().getName());
                    }
                    else
                    {    
                        throw new ConstraintException("Cannot change the primarykey status of field "+keyDef.getName()+" in class "+
                                                      keyDef.getOwner().getName()+" as primarykeys are used in class "+
                                                      baseFieldDef.getOwner().getName()+" by the collection "+usingFeature.getName()+
                                                      " from class "+usingFeature.getOwner().getName());
                    }
                }

                baseFieldDef = (FieldDescriptorDef)baseFieldDef.getOriginal();
            }
            while (baseFieldDef != null);
        }
    }
private void checkKeyModifications ( ModelDef modelDef , FieldDescriptorDef keyDef ) throws ConstraintException { FieldDescriptorDef baseFieldDef = ( FieldDescriptorDef ) keyDef . getOriginal ( ) ; boolean isIgnored = keyDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ; boolean changesJdbcType = ! baseFieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) . equals ( keyDef . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) ) ; boolean changesPrimary = baseFieldDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_PRIMARYKEY , false ) != keyDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_PRIMARYKEY , false ) ; if ( isIgnored || changesJdbcType || changesPrimary ) { FeatureDescriptorDef usingFeature = null ; do { usingFeature = usedByReference ( modelDef , baseFieldDef ) ; if ( usingFeature != null ) { if ( isIgnored ) { throw new ConstraintException ( "Cannot ignore field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " because it is used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " by the reference " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } else if ( changesJdbcType ) { throw new ConstraintException ( "Modification of the jdbc-type for the field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " is not allowed because it is used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " by the reference " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } else { throw new ConstraintException ( "Cannot change the primarykey status of field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " as primarykeys are used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " by the reference " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } } usingFeature = usedByCollection ( modelDef , baseFieldDef , changesPrimary ) ; if ( usingFeature != null ) { if ( isIgnored ) { throw new ConstraintException ( "Cannot ignore field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " because it is used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " as a foreignkey of the collection " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } else if ( changesJdbcType ) { throw new ConstraintException ( "Modification of the jdbc-type for the field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " is not allowed because it is used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " as a foreignkey of the collecton " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } else { throw new ConstraintException ( "Cannot change the primarykey status of field " + keyDef . getName ( ) + " in class " + keyDef . getOwner ( ) . getName ( ) + " as primarykeys are used in class " + baseFieldDef . getOwner ( ) . getName ( ) + " by the collection " + usingFeature . getName ( ) + " from class " + usingFeature . getOwner ( ) . getName ( ) ) ; } } baseFieldDef = ( FieldDescriptorDef ) baseFieldDef . getOriginal ( ) ; } while ( baseFieldDef != null ) ; } }
Checks the modifications of the given inherited field if it is used as a foreignkey in a
reference/collection or as the corresponding primarykey, e.g. that the jdbc-type is not changed etc.

@param modelDef The model to check
@throws ConstraintException If the field has invalid modifications