Я пытаюсь получить данные Ignite Cache через jdbc. Для этого я определяю новый пользовательский класс и аннотирую такие поля:
public class MyClass implements Serializable {
@QuerySqlField(index = true)
public Integer id;
@QuerySqlField(index = true)
public String records_offset;
@QuerySqlField(index = true)
public Integer session_id;
...
}
Тогда я начинаю зажигать таким образом:
CacheConfiguration conf = new CacheConfiguration();
conf.setBackups(1);
conf.setName("test");
QueryEntity queryEntity = new QueryEntity();
queryEntity.setKeyType(Integer.class.getName());
queryEntity.setValueType(CDR.class.getName());
queryEntity.setTableName("CDR");
conf.setQueryEntities(Arrays.asList(queryEntity));
IgniteConfiguration iconf = new IgniteConfiguration();
iconf.setCacheConfiguration(conf);
iconf.setPeerClassLoadingEnabled(true);
this.ignite = Ignition.start(iconf);
this.cache = ignite.getOrCreateCache("test");
Теперь, когда я пытаюсь получить данные из JDBC, я получаю ошибку:
Error: class org.apache.ignite.binary.BinaryObjectException: Custom objects are not supported (state=50000,code=0)
Я мог бы определить набор полей, чтобы получить возможность извлекать данные из JDBC
LinkedHashMap<String, String> fields = new LinkedHashMap();
fields.put("session_id", Integer.class.getName());
fields.put("records_offset", String.class.getName());
queryEntity.setFields(fields);
Но зачем мне это делать, если я уже аннотировал поле в определении класса?