Reading the documentation in https://apacheignite.readme.io/docs/affinity-collocation and in ignite-examples, the example for using @AffinityKeyMapped assumes that the key is an object: PersonKey is a class with personId and companyId, and companyId has the annotation.
In my use case my key is a simple integer. I am using the domain model generated from WebConsole. I have 2 classes: Item and ItemInstance, and ItemInstance has a foreign key reference to Item. My model is defined as follows:
public class ItemInstance implements Serializable {
private static final long serialVersionUID = 0L;
@QuerySqlField(index = true)
@AffinityKeyMapped
private int itemId;
private String serialNumber;
...
}
public class Item implements Serializable {
private String name;
...
}
During node startup and cache loading there are no errors, but when executing a query I get incomplete results- it is retrieving only the data that are collocated. I know this because when I run the same query in Web Console with the "Allow non-collocated joins" ticked, I get the complete result.
Note that I am not using AffinityKey as in the other example because I am reading from the 3rdparty database, not doing any put.
Can you please tell me the following:
Does ignite support @AffinityKeyMapped on integer keys similar to my usage above;
Do we need to define @AffinityKeyMapped as well in the spring XML configuration? I thought this might be the issue, but I cannot find it in Web Console, nor online.
Thanks!