Hi,

I declared a test table with four fields, two of these are key fields.
When querying the cache using the Java api, the "value" BinaryObject does
not contain the key values, whereas using SQL all fields are shown.

That is, after running:
create table test (a int, b int, c int, d int, primary key (a,b)) with
"cache_name=test, key_type=domain.key, value_type=domain.val";
insert into test values(1,2,3,4), (3,4,5,6);
select * from test;

IgniteCache<Object, BinaryObject> cache =
ig.getOrCreateCache("test").withKeepBinary();
for (Entry<Object, BinaryObject> item : cache) {
          log.info("key={} val={}",  item.getKey(), item.getValue());
}

The output is
18:07:50.263 [main] INFO  c.t.BrowseBinaryClient - key=domain.key
[idHash=138536309, hash=783969056, A=3, B=4] val=domain.val
[idHash=665137804, hash=1464087008, C=5, D=6]
18:07:50.263 [main] INFO  c.t.BrowseBinaryClient - key=domain.key
[idHash=509559152, hash=103851104, A=1, B=2] val=domain.val
[idHash=1815370847, hash=783969056, C=3, D=4]

I understand the key values are only placed in the key object; and that not
copying the key values in the value object prevents duplication.
Anyway I need to retrieve the "full" object from the cache, that is, an
object containing all 4 fields.
(that would be similar to using "select * from table" using jdbc: all fields
are returned).


Is there a way to configure the cache, so that calling cache.get(key)
returns a BinaryObject containing all 4 fields?

Otherwise, I think the alternatives would be (I don't like them, is there
any better way do do this?)
> composing the key and the value into the final object, after retrieving it
> from the cache
> working with the "javax.entry" type
> duplicating the key fields as value fields


Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to