I have a cache with an AffinityKey as Key and want to insert an entry. If i try to insert the entry using a SQL-Insert statement i get an exception stating "Update of composite key column is not supported" which i guess is because the AffinityKey is a composite key. On https://ignite.apache.org/docs/latest/SQL/indexes#indexing-nested-objects i have read that if you are using indexed nested objects you will no longer be able to use insert or update statements but it is not mentioned on https://ignite.apache.org/docs/latest/data-modeling/affinity-collocation for composite keys.
Does using composite keys also cause insert and update statements to no longer be usable or am i missing something?
Example:
// creating cache using QueryEntities
cache = ignite.CreateCache<AffinityKey, MyClass>(new CacheClientConfiguration(cacheConfiguration)
{
Name = "MyCache",
QueryEntities = new[]
{
new QueryEntity(typeof(AffinityKey), typeof(MyClass)){ TableName = "MyTable" }
},
});
// insert statement
cache.Query(
new SqlFieldsQuery(
"INSERT INTO " +
"MyTable ( " +
"_key, " +
$"{nameof(MyClass.Text)} ) " +
"VALUES ( " +
"?, " +
"? )"
)
{
Arguments = new object[]
{
new AffinityKey("Key1", "AffinityKey1"),
"TextValue"
},
});
Solution: As described below by @Alexandr Shapkin, setting "IGNITE_SQL_ALLOW_KEY_VAL_UPDATES" to true makes it possible to update entries via SQL that have been added using a composite key.
For anyone interested https://ignite.apache.org/docs/latest/setup#setting-ignite-system-properties shows how to list available ignite properties/environment variables with a brief description.