Hi,

In this case, customer should be also a BinaryObject, so, you have to
access it at first and only after get a certain field.

Evgenii

сб, 24 нояб. 2018 г. в 00:38, joseheitor <[email protected]>:

> Given the following model data structure for a given document record:
>
> {
>   "trans": {
>     "cust": {
>       "firstname": "Bone",
>       "lastname": "Klebes",
>       "email": "[email protected]",
>       "gender": "Male"
>     },
>     "ipaddress": "104.89.149.184",
>     "date": "2017-12-01",
>     "amount": 1217,
>     "currency": "NOK"
>   }
> }
>
> ...modelled in Java by a Transaction class and a Customer class,
>
> And the following code to perform a ScanQuery:
>
> String date = "2017-12-01";
> int amount = 1000;
> String lastname = "Klebes";
>
> IgniteCache<Integer, BinaryObject> cache =
> database.getCache().withKeepBinary();
> ScanQuery<Integer, BinaryObject> filter = new ScanQuery<>(
>   new IgniteBiPredicate<Integer, BinaryObject>() {
>     @Override
>     public boolean apply(Integer key, BinaryObject trans)
>     {
>       if (!trans.<String>field("date").equals(date))
>         return false;
>       if (trans.<Integer>field("amount") <= amount)
>         return false;
>       *(???) if
> (!trans.<String>field("customer.lastname").equals(lastname))*
>         return false;
>       return true;
>     }
>   }
> );
> List result = cache.query(filter).getAll();
>
> What is the correct syntax for accessing the nested 'Customer.lastname'
> field?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to