Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable. Ignite Error

痞子三分冷 提交于 2019-12-11 05:16:51

问题


I am trying out the simple person example for a read through cache. Set up basic table and here is my code that i am trying to run

 IgniteConfiguration cfg = new IgniteConfiguration();
        cfg.setClientMode(true);
        cfg.setPeerClassLoadingEnabled(true);

        // Create store factory.
        CacheJdbcPojoStoreFactory storeFactory = new CacheJdbcPojoStoreFactory();
        storeFactory.setDataSourceBean("dataSource");

        CacheConfiguration sampleCache = CacheConfig.cache("sampleCache", storeFactory);
        sampleCache.setIndexedTypes(PersonKey.class,Person.class);
        cfg.setCacheConfiguration(sampleCache);



        Ignition.start("default-config1.xml");
        Ignite ignite=Ignition.ignite();

        IgniteCache<IncappconfigKey,INCAppConfig> cache =ignite.getOrCreateCache("sampleCache");
        cache.loadCache(null);

        SqlQuery  sqlQuery=new SqlQuery(Person.class,"id=?");
        cache.query(sqlQuery.setArgs(1l));

Am setting the index type still am getting the above error. Can some one please help. Stuck on this for some time now.

All the CacheConfig and other classes are auto generated by the import tool.

来源:https://stackoverflow.com/questions/39515011/use-setindexedtypes-or-settypemetadata-methods-on-cacheconfiguration-to-enable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!