Persisting data to MySQL

In this section, we will create a model Java class, 'conference', and persist it to a MySQL table. We already installed MySQL in Chapter 2, Understanding the Topologies and Caching Strategies. Let's reuse the MySQL instance to persist cache data.

Create a Java program, store objects into a cache, and then persist the cached data to a MySQL table. Follow this process to persist data to a MySQL table:

  1. Modify the build.gradle file and add a dependency for the MySQL client with the compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.11' command.
  2. Create a schema called 'persistence' and add a new table called 'conference' with the following DDL:
      CREATE TABLE `persistence`.`conference` ( `id` INT(10) ...

Get Apache Ignite Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.