Kenan, I've found there is an issue that can cause unexpected behavior when using Cassandra keyPersistence configuration with Ignite annotations [1]. But XML way should work.
I'm confused as in first message you wrote Test1Key has 'id' field, in last message it has 'my_id' field and 'myId' in mapping? Is it possible to have same field name in Ignite and Cassandra? or configure proper alias for field in QueryEntity configuration? [1] https://issues.apache.org/jira/browse/IGNITE-6280 On Wed, Oct 25, 2017 at 4:27 PM, Kenan Dalley <[email protected]> wrote: > I don't understand what the reasoning behind manually setting the > IndexedType pair in the configuration. Yes, this is a field that is > indexed, but the problem is that it's not correctly pulling the data from > C* and it's worked in the past with other C* tables/caches via @Annotation > without the need to manually set it. Also, based on the changes that I > made, it didn't make any difference manually setting the IndexedType pair: > either by Java or by XML. I may not have set it up correctly, though. Note: > I did not have both the XML and the Java configuration set at the same > time. I had one or the other and neither worked. By Java in > Application.java.test1() method > > private void test1() { > System.out.println(">>> Cassandra cache store Test1 example > started."); > CacheConfiguration<Test1Key, Test1> config = new > CacheConfiguration<>(Application.TEST1_CACHE_NAME); > config.setIndexedTypes(String.class, Test1Key.class); > try (IgniteCache<Test1Key, Test1> cache = this.ignite > // .cache(Application.TEST1_CACHE_NAME)) { > .getOrCreateCache(config)) { > > By XML in cassandra-ignite.xml > > > <bean > class="org.apache.ignite.configuration.CacheConfiguration"> > <property name="name" value="Test1" /> > <property name="readThrough" value="true" /> > <property name="writeThrough" value="true" /> > <!-- <property name="writeBehindEnabled" value="true" /> > --> > <property name="cacheStoreFactory"> > <bean > class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory"> > <!-- Datasource configuration bean which is > responsible for Cassandra connection details --> > <property name="dataSourceBean" > value="cassandraDataSource" /> > <!-- Persistent settings bean which is > responsible for the details of how objects will be persisted to Cassandra --> > <property name="persistenceSettingsBean" > value="test1Cache_persistence_settings" /> > </bean> > </property> > <property name="queryEntities"> > <list> > <bean class="org.apache.ignite.cache.QueryEntity"> > <property name="keyType" > value="java.lang.String"/> > <property name="valueType" > value="com.gm.test_cassandra.model.Test1Key"/> > <property name="fields"> > <map> > <entry key="myId" > value="java.lang.String"/> > </map> > </property> > <property name="indexes"> > <list> > <bean > class="org.apache.ignite.cache.QueryIndex"> > <constructor-arg value="myId"/> > </bean> > </list> > </property> > </bean> > </list> > </property> > </bean> > > > ------------------------------ > Sent from the Apache Ignite Users mailing list archive > <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com. > -- Best regards, Andrey V. Mashenkov
