简体   繁体   English

是否可以同时使用 JPA 存储库和 Ignite 存储库?

[英]is it possible to use JPA repository and Ignite repository simultaneously?

I want to use JPA repository and Ignite repository to CRUD the data.我想使用 JPA 存储库和 Ignite 存储库来 CRUD 数据。 Also, I want to connect the Ignite in-memory database with RDB (like mysql, mariaDB, postgresql, ..).另外,我想将 Ignite 内存数据库与 RDB(如 mysql、mariaDB、postgresql 等)连接起来。

Is it possible to use JPA repository and Ignite repository simultaneously?是否可以同时使用 JPA 存储库和 Ignite 存储库? If it is possible, I hope to know how to make them.如果可能,我希望知道如何制作它们。

Iginte respository means, Interface IgniteRepository. Iginte 存储库的意思是,接口 IgniteRepository。 For example,例如,

@RepositoryConfig(cacheName = "DogCache")
public interface DogRepository extends IgniteRepository < Dog, Long > {
 List < Dog > getDogByName(String name);
 Dog getDogById(Long id);
}

Yes, it should work.是的,它应该工作。

The important thing is cache name (in your case DogCache ).重要的是缓存名称(在您的情况下为DogCache )。 Once you know Ignite cache name you can access it via any API, such as JPA, Spring Data, Cache API, SQL (if indexing is configured for that cache), REST, etc, etc.一旦知道 Ignite 缓存名称,您就可以通过任何 API 访问它,例如 JPA、Spring Data、Cache API、SQL(如果为该缓存配置了索引)、REST 等。

If both JPA and Spring Data are configured to use the same cache, and they use same POJOs to access it, they should work together.如果 JPA 和 Spring Data 都配置为使用相同的缓存,并且它们使用相同的 POJO 来访问它,则它们应该协同工作。

Of course, if either of those has things like 2nd level cache, they may go out of sync, but it will happen outside of Apache Ignite's zone of responsibility.当然,如果其中任何一个都有二级缓存之类的东西,它们可能会不同步,但它会发生在 Apache Ignite 的责任范围之外。

Please see blog post about Ignite JPA to understand how cache name maps to Repository.请参阅有关 Ignite JPA 的博客文章以了解缓存名称如何映射到存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM