The following guidelines are highly recommended to build robust and efficient applications as well as to avoid common mistakes. XAP was designed to be robust and to provide clear exceptions when the usage is wrong. Sometimes a plain validation is too harsh, as it might break backward-compatibility and prevent existing users from upgrading to the latest version.
For such cases the Protective Mode was introduced. The validation is on by default, but can be disabled using a system property. This protects new users from repeating old mistakes, and encourages existing users to fix their code (yet allows them to disable the protection if they choose so).
The Space Routing property is used to partition the data across different partitions. It is recommended to define such property explicitly to control how data is partitioned and avoid common mistakes like writing data to the wrong partition.
See more info on routing property Java version | .NET version.
com.gigaspaces.client.protective.ProtectiveModeException: Operation is rejected - no routing value provided when writing an entry of type `MyClass` in a partitioned space.
A Space routing value should be specified before writing the space. Missing routing value would result in a remote client not being able to locate this entry as the routing value will not match the partition the entry is located.
It is highly recommended that you modify them and set the right routing.
The following example demonstrates one way to handle writing entries to a partition with the wrong routing value.
If you must use primitive property types, then assign null values. This is enforced by the protective mode since 9.7.
When querying the space using template matching Java version | .NET version, null properties are ignored and non-null properties are matched. Since primitive properties cannot be set to null, a nullValue can be assigned to a property to indicate a value which will be treated as null when using template matching.
See primitive types matching Java version | .NET version.
A protective mode was added to protect against querying with a template that contains one or more primitive properties without a nullValue, since such templates are likely to produce unexpected results.
It is highly recommended that you define nullValue where appropriate, or switch to SQLQuery Java version | .NET version instead.