Spring Data Integration
Use Spring Data JDBC repositories with GridGain 9 through the IgniteDialect — Maven setup, entities, repositories, custom queries, and pagination.
Overview
Spring Data Framework provides a unified and widely used API that allows abstracting an underlying data storage from the application layer. Spring Data helps you avoid locking to a specific database vendor, making it easy to switch from one database to another with minimal efforts. GridGain supports Spring Data JDBC by implementing IgniteDialect.
Prerequisites
Java 17 or higher
Spring Boot 3.0 or higher
Spring Data JDBC 3.0 or higher
Limitations
GridGain does not auto-generate primary keys. You need to provide ID values explicitly.
Locking clauses (
@Lock) are not supported.Single query loading for related entities is not supported.
Composite keys are not supported.
Maven Configuration
Spring Data integration requires three dependencies:
spring-data-igniteprovides the SQL dialect for Ignite-compatible query generation;spring-boot-starter-data-jdbcprovides the Spring Data JDBC framework.
The pom.xml example below shows how you can add spring support:
Configuration
Application Properties
Configure both the GridGain client connection and JDBC datasource in your application.properties:
Dialect Provider Registration
Spring Data JDBC needs to generate database-specific SQL for operations like pagination, identity columns, and certain functions. The spring-data-ignite artifact includes an IgniteDialectProvider that teaches Spring Data how to generate Ignite-compatible SQL.
The dialect provider is registered via Spring's SPI mechanism. Create the file src/main/resources/META-INF/spring.factories with the following content:
Without this configuration, Spring Data falls back to generic ANSI SQL, which works for basic queries but may fail for database-specific operations.
Defining Entities
Define entity classes that map to GridGain tables. Use standard Spring Data annotations:
Create the corresponding table in GridGain:
Defining Repositories
Define repository interfaces by extending Spring Data repository interfaces:
Spring Data automatically implements these methods based on their names. No additional code is required.
Using Repositories
Inject and use repositories in your Spring components:
Custom Queries
For complex queries that cannot be expressed through method names, use the @Query annotation:
Pagination and Sorting
GridGain supports pagination and sorting through Spring Data's standard interfaces:
Sorting
Pagination
Authentication
When authentication is enabled on the GridGain cluster, configure credentials for both the client and JDBC connections:
This page is: Copyright © 2026 MariaDB. All rights reserved.
Last updated
Was this helpful?

