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:
- 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.
- Create a schema called 'persistence' and add a new table called 'conference' with the following DDL:
CREATE TABLE `persistence`.`conference` ( `id` INT(10) ...