I want to use JPA repository and Ignite repository to CRUD the data. Also, I want to connect the Ignite in-memory database with RDB (like mysql, mariaDB, postgresql, ..).
Is it possible to use JPA repository and Ignite repository simultaneously? If it is possible, I hope to know how to make them.
Iginte respository means, Interface 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
). 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.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.
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.
Please see blog post about Ignite JPA to understand how cache name maps to Repository.