Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

GridGain's Spring Data integration is based on Spring Data JDBC, not Spring Data JPA. This provides better performance and more predictable behavior, as it avoids the complexity and overhead of ORM frameworks.

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-ignite provides the SQL dialect for Ignite-compatible query generation;

  • spring-boot-starter-data-jdbc provides 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:

The example below uses the @Id and @Table annotations from Spring. Make sure your IDE imports the correct annotation to avoid possible conflict with GridGain 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:

Use named parameters (:paramName) or positional parameters (?1, ?2) in your queries. Named parameters require the @Param annotation.

Pagination and Sorting

GridGain supports pagination and sorting through Spring Data's standard interfaces:

Sorting

Pagination

Page executes an additional count query to determine the total number of elements, while Slice does not. Use Slice for better performance when you don't need the total count.

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?