有什麼辦法可以在apache的點火器上運行sql字段查詢(二進制對象沒有定義java類)?Apache Iginte BinaryObject SqlFieldsQuery
我要執行這樣的事情:
CacheConfiguration<Integer, Object> cfg = new CacheConfiguration<>();
cfg.setName("test_bo");
cfg.setIndexedTypes(Integer.class, BinaryObject.class);
IgniteCache<Integer, Object> cache = ignite.getOrCreateCache(cfg);
BinaryObjectBuilder builder = ignite.binary().builder(BinaryObject.class.getName());
BinaryObject object = builder.setField("xxx", "yyy").build();
cache.put(1, object);
List<Object[]> collect = cache.withKeepBinary().query(
new SqlFieldsQuery("select xxx from BinaryObject")).getAll().stream()
.map(list -> list.toArray(new Object[list.size()]))
.collect(Collectors.toList());
assertThat(collect).containsExactly(new Object[]{"yyy"});
但我有那場沒有定義異常:
Caused by: org.h2.jdbc.JdbcSQLException: Column "XXX" not found; SQL statement: select xxx from BinaryObject [42122-175]
謝謝! QueryEntity的方法非常適合。因爲我們根本沒有類定義,並且在運行時構建二進制對象是最適合我們應用程序的方式。 –