Hello! I think you should not be using AffinityKey type here but rather your own custom type (similar with value) and name its fields "id" and "city_id".
I don't think you can change names of fields when using AffinityKey. Regards, -- Ilya Kasnacheev вт, 9 июл. 2019 г. в 07:09, okni-67 <[email protected]>: > > City_id is defined in the key, key never show in the value? How can I use > sql insert ,insert the key like cache , and how can I use cache insert, > insert the value like sql ,I want insert use cache or use sql keep the same > . Can you give me a solution? > > 在 2019年7月9日,上午11:46,Andrey Dolmatov <[email protected]> 写道: > > Cityid should be part of key builder, not value builder. That's because > cityid defined in the key > > On Tue, Jul 9, 2019, 4:56 AM okni-67 <[email protected]> wrote: > >> >> i created a table below >> >> *CREATE* *TABLE* *IF* *NOT* *EXISTS* person ( >> id *int*, >> city_id *int*, >> name *varchar*, >> age *int*, >> company *varchar*, >> *PRIMARY* *KEY* (id, city_id) >> ) *WITH* >> "ATOMICITY=ATOMIC,WRITE_SYNCHRONIZATION_MODE=PRIMARY_SYNC,cache_name=PersonCache,template=partitioned,backups=1,affinity_key=city_id, >> key_type=org.apache.ignite.cache.affinity.AffinityKey, >> value_type=com.okni.okkong.data.common.entity.Person”; >> >> And I use sql below >> >> *INSERT* *INTO* person *values*(2,5,'test1',19,'okni’) >> >> I can find data like below >> >> And. I use ignite cache put binary object like below >> >> >> This problem is in DBeaver my new data id and city_id is null. >> >> >> I use cache can get the cache insert id and city id value, but the sql >> insert operate data the id is null, like below >> >> I want to know why , thanks. >> >> >> >> <PastedGraphic-1.png><PastedGraphic-1.png><PastedGraphic-1.png> > <PastedGraphic-1.png> > > >
