英文:
ClientCacheConfiguration is not saved to table
问题
在使用Ignite时,我曾使用CacheConfiguration,但遇到了身份验证问题。
因此,我开始将CacheConfiguration更改为clientCacheConfiguration。然而,在将其转换为CacheConfiguration后,我开始注意到它
无法保存到表格,因为它缺少setIndexedTypes方法,例如。
之前
CacheConfiguration<String, IgniteParRate> cacheCfg = new CacheConfiguration<>();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
cacheCfg.setIndexedTypes(String.class, IgniteParRate.class);
现在
ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
//cacheCfg.setIndexedTypes(String.class, IgniteParRate.class); --> 这不提供
我仍然需要填充表格,以便我们更容易验证(使用像DBeaver这样的客户端IDE)
有办法解决这个问题吗?
英文:
Was using CacheConfiguration in Ignite until I stuck with issue on how to authenticate.
Because of that I was starting to change the CacheConfiguration to clientCacheConfiguration. However after converting it to CacheConfiguration I started to notice that it
does not able to save into table because it lack of method setIndexedTypes eg.
Before
CacheConfiguration<String, IgniteParRate> cacheCfg = new CacheConfiguration<>();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
cacheCfg.setIndexedTypes(String.class, IgniteParRate.class);
New
ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
//cacheCfg.setIndexedTypes(String.class, IgniteParRate.class); --> this is not provided
I still need the table to be populated so it easier for us to verify ( using Client IDE like DBeaver)
Any way to solve this issue?
答案1
得分: 2
如果需要在使用轻客户端动态创建表格/缓存,您需要使用setQueryEntities()
方法手动定义SQL可用的列。(通过传递带有注解的类基本上是定义查询实体的快捷方式。)我不确定为什么在轻客户端中不可用setIndexedTypes()
,也许可以在开发者邮件列表中提问。
或者,您可以使用厚客户端预先定义您的缓存/表格。在使用轻客户端时它们仍然可用。
英文:
If you need to create tables/cache dynamically using the thin-client, you'll need to use the setQueryEntities()
method to define the columns available to SQL "manually". (Passing in the classes with annotations is basically a shortcut for defining the query entities.) I'm not sure why setIndexedTypes()
isn't available in the thin-client; maybe a question for the developer mailing list.
Alternatively, you can define your caches/tables in advance using a thick client. They'll still be available when using the thin-client.
答案2
得分: 1
你可以尝试使用缓存模板来补充现有答案。
https://apacheignite.readme.io/docs/cache-template
预先配置模板,在从薄客户端创建缓存时使用它们。
英文:
To add to existing answer, you can also try to use cache templates for that.
https://apacheignite.readme.io/docs/cache-template
Pre-configure templates, use them when creating caches from thin client.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论