Spring Data R2DBC1.2.5
Spring Data R2DBC, part of the larger Spring Data family, makes it easy to implement R2DBC based repositories. R2DBC stands for Reactive Relational Database Connectivity, an incubator to integrate relational databases using a reactive driver. Spring Data R2DBC applies familiar Spring abstractions and repository support for R2DBC. It makes it easier to build Spring-powered applications that use relational data access technologies in a reactive application stack.
Spring Data R2DBC aims at being conceptually easy. In order to achieve this it does NOT offer caching, lazy loading, write behind or many other features of ORM frameworks. This makes Spring Data R2DBC a simple, limited, opinionated object mapper.
Spring Data R2DBC allows a functional approach to interact with your database providing
DatabaseClient as the entry point for applications.
Get started by picking a database driver and create a
PostgresqlConnectionFactory connectionFactory = new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder() .host(…) .database(…) .username(…) .password(…).build()); DatabaseClient client = DatabaseClient.create(connectionFactory); Mono<Integer> affectedRows = client.execute() .sql("UPDATE person SET name = 'Joe'") .fetch().rowsUpdated(); Flux<Person> all = client.execute() .sql("SELECT id, name FROM person") .as(Person.class) .fetch().all();
The client API provides covers the following features:
Execution of generic SQL and consumption of update count/row results.
SELECTwith paging and ordering.
SELECTof mapped objects with paging and ordering.
INSERTwith parameter binding.
INSERTof mapped objects.
Parameter binding using the native syntax.
Result consumption: Update count, unmapped (
Map<String, Object>), mapped to entities, extraction function.
Reactive repositories using
Quickstart Your Project
|1.2.5 CURRENT GA||Reference Doc.||API Doc.|
|1.3.0-M4 PRE||Reference Doc.||API Doc.|
|1.1.7.RELEASE GA||Reference Doc.||API Doc.|