Search code examples
ignite

RDMS and Ignite Integration


I am reading the https://apacheignite-mix.readme.io/v1.7/docs/automatic-persistence

I got a question: What is the difference between the following two choices: 1. export the schema by one table each time(https://files.readme.io/ADInqx2dT2lbvfH5c4Ag_ignite-schema-import-demo-generate.png) 2. export the schema of all the tables at a time(https://files.readme.io/bI8nWm38RAiLUTzXIxkF_ignite-schema-import-02.png)

If I export all the tables at one time, it will add all these tables'jdbcTypes to the CacheJdbcPojoStoreFactory

like the following code:

    // Configure JDBC types. 
Collection<JdbcType> jdbcTypes = new ArrayList<>();
jdbcTypes.add(jdbcTypePerson(cacheName));
jdbcTypes.add(jdbcTypeCompany(cacheName));
jdbcTypes.add(jdbcTypeStudent(cacheName));
jdbcTypes.add(jdbcTypeTeacher(cacheName));
storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));

But, for a given cachename, eg, personCacheName, only jdbcTypePerson will make sense to this person cache.

So, I am not sure whether other jdbcType like jdbcTypes.add(jdbcTypeCompany(cacheName)); will make sense.It looks to me that adding all the irrelated jdbcTypes to one cache is incorrect.


Solution

  • @Tom, schema import utility is a little bit outdated. You could try Web Console to import database schema and generate POJOs, configs and mach more. I will add documentation to Apache Ignite Integration today.

    You will need to:

    1. Go to Web Console and register.
    2. Create cluster with some name on Clusters screen.
    3. Go to Model screen and click on "Import from database" button. You may need to download Apache Ignite web agent (a java program that will connect to RDBMs, load metadata and send it to browser).
    4. After agent started you will see step-by step wizard to import metadata. After import go to Summary screen and download project.

    This project will have pom.xml and could be imported in any Java IDE. Also there will be java classes for POJOs, java classes with cluster configuration and XML files with Spring configuration.

    Hope this help.