1250   Attempt to change key value in a mapping method get operation: refer to jommsg.log

Cause

This error occurs if a mapping method for a property that is used as a key in a dictionary returns a value in the _value parameter that is not equal to the value of the property in the object. This is not allowed.

The restriction does not apply to properties used as keys in dynamic dictionaries, unless defined in the schema as keys in any other dictionary.

An example of such a method is as follows.

// mapping method for "rate" property which is a dictionary key
rate(set: Boolean; _value: Real io) mapping;
begin
    if not set then
        _value := _value * app.getCurrentRateModifier;
    endif;
end;

If app.getCurrentRateModifier returns a value that is different from the value returned when the rate property was set, executing this method raises a 1250 - Attempt to change key value in a mapping method get operation exception during automatic inverse maintenance or when adding to or removing the instance from the collection, because _value is changed to be different from the value of the rate property in the object. JADE does not allow this because such a mapping method would defeat dictionary key maintenance (the method may return one value for the key when an object is added to a dictionary and a different value for subsequent accesses, causing the object not to be found in the collection).

By implication, virtual properties can never be used as keys because they are never stored in the object; their values are always derived from their mapping method. The _value parameter will therefore always be different from the object value (which is always null for virtual collections).

Action

Change the mapping method so that it always returns the object property value.