Hi again,

We already discussed about it recently. At the moment some things works
incorrect in 2.4:

1)Rest API only support String as key and value. And looks like you can't
use affinity key on strings for the same issue. But if you can setup it
using AffinityKeyMapper anotation:

    public static class Key {
        @AffinityKeyMapped
        @QuerySqlField(index = true)
        private final Stringkey;

        public Key(Stringkeykey) {
            this.key = key;
        }

        public Stringkey getKey() {
            return key;
        }
    } 

And put it:

CacheConfiguration<Key, Person> cfg = new CacheConfiguration<>("cache");

It should work like example from here:

http://apache-ignite-users.70518.x6.nabble.com/Inconsistency-reading-cache-from-code-and-via-REST-td21228.html#a21293

2)qryexe doesn't work correct. At some reason it ignores _key and _value
fields. Looks like it could be solved in future releases.

How I am going to show you some working examples how you avoid second
problem:

StartServerNode.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1704/StartServerNode.java>
  
StartClientNode.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t1704/StartClientNode.java>
  

1)qryfldexe - exactly the same that you want but had another syntax:

Here -
select%20firstName%2C%20lastName%20from%20Person%20where%20_key%20%3D%201%20or%20_key%20%3D%203
is select firstName, lastName from Person where _key = 1 or _key = 3

http://127.0.0.1:8080/ignite?cmd=qryfldexe&pageSize=10&cacheName=Person&qry=select%20firstName%2C%20lastName%20from%20Person%20where%20_key%20%3D%201%20or%20_key%20%3D%203

{"successStatus":0,"error":null,"sessionToken":null,"response":{"items":[["John1","Doe1"],["John3","Doe3"]],"last":true,"fieldsMetadata":[{"schemaName":"Person","typeName":"PERSON","fieldName":"FIRSTNAME","fieldTypeName":"java.lang.String"},{"schemaName":"Person","typeName":"PERSON","fieldName":"LASTNAME","fieldTypeName":"java.lang.String"}],"queryId":4}}

2)get command return the value of some key:

http://127.0.0.1:8080/ignite?cmd=get&cacheName=Person&key=3

{"successStatus":0,"affinityNodeId":"37f9d00d-8a7a-4db4-a1af-16471a548ce1","error":null,"sessionToken":null,"response":{"firstName":"John3","lastName":"Doe3","id":"3"}}

3)getall command return several values for some keys

http://127.0.0.1:8080/ignite?cmd=getall&cacheName=Person&k1=1&k2=2

{"successStatus":0,"affinityNodeId":null,"error":null,"sessionToken":null,"response":{"1":{"firstName":"John1","lastName":"Doe1","id":"1"},"2":{"firstName":"John2","lastName":"Doe2","id":"2"}}}

Hope that it will help you.

BR,
Andrei



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

Reply via email to