Please use builder from my example. You use wrong types here:

    BinaryObjectBuilder builder1 = ignite.binary().builder("keys");

    BinaryObjectBuilder builder2 = ignite.binary().builder("fields");

You should use the same types that you have in xml configuration.

Yes, you need to create 2 binary objects - one with key fields and the
second with value fields only.

пн, 20 апр. 2020 г. в 11:18, narges saleh <[email protected]>:

> Thanks Evgenii. I am still a little bit confused.
> So if my CustomKey is composed of Client_ID, Customer_ID, and other fields
> are Customer_name, Client_name, then I populate the cache this way? Do I
> need to build two binary objects, one for the custom key and another for
> the rest of the fields?
>
>     IgniteDataStreamer<CustomKey, BinaryObject> streamer =
> grid.dataStreamer("Customer");
>
>     streamer.keepBinary(true);
>
>     BinaryObjectBuilder builder1 = ignite.binary().builder("keys");
>
>     BinaryObjectBuilder builder2 = ignite.binary().builder("fields");
>
>     BinaryObject b1 = null;
>
>         BinaryObject b2 = null;
>
>                  builder1.setField("Client_ID", 1);
>
>                  builder1.setField("Customer_ID", 1);
>
>                  builder2.setField("customer_name", "jim");
>
>                 builder2.setField("client_name", "joe");
>
>          b1 = builder1.build();
>
>          b2 = builder2.build;
>
>          streamer.adddata(b1, b2);
>
>
> On Mon, Apr 20, 2020 at 12:22 PM Evgenii Zhuravlev <
> [email protected]> wrote:
>
>>  Hi,
>>
>> >How do I do streamer.addData to add the binary objects?
>> If you want to work without classes, you can use binary object builder,
>> just take it for these types:
>>
>> ignite.binary().builder(CustomKey);
>>
>> ignite.binary().builder(Customer);
>>
>> And set fields in it:
>>
>> builder.setField("Client_ID", value);
>>
>> These objects can be used for streaming.
>>
>> However, if you want to use java objects in future, you will need to change 
>> keyType and keyType to the full name with a package.
>>
>>
>> Evgenii
>>
>>
>> пн, 20 апр. 2020 г. в 08:53, narges saleh <[email protected]>:
>>
>>> Hi All,
>>> If I have a query entity defined with composite CustomKey, how do I
>>> insert to the cache,here, Customer, via the DataStreamer, using binary
>>> object builder? Do I need to define an object for the composite CustomKey?
>>> I am trying to define all the tables/caches via the configuration file. How
>>> do I do streamer.addData to add the binary objects?
>>> For example the QE is defined as
>>>      <bean class="org.apache.ignite.cache.QueryEntity">
>>>                                 <property name="keyType"
>>> value="CustomKey"/>
>>>                                 <property name="valueType"
>>> value="Customer"/>
>>>                                 <property name="tableName"
>>> value="Customer"/>
>>>                                 ....
>>>
>>>                 <property name="keyFields">
>>>                                   <set>
>>>                                     <value>Client_ID</value>
>>>                                     <value>Customer_ID</value>
>>>                                     </set>
>>>                  </property>
>>> thanks.
>>>
>>>

Reply via email to