Reactive Relational Database Connectivity
database r2dbc reactive
Reactive Relational Database Connectivity
Picking a database driver and create a R2dbcEntityTemplate instance:
- Jasync-sql is a Simple, Netty based, asynchronous, performant and reliable database drivers for PostgreSQL and MySQL written in Kotlin.
The Spring Data R2DBC 3.x binaries require:
- JDK level 17 and above
- Spring Framework 6.0.11 and above
- R2DBC and above
Id Generation:
- Use @Id
- When your database has an auto-increment column for the ID column, the generated value gets set in the entity after inserting it into the database.
- Spring Data R2DBC does not attempt to insert values of identifier columns when the entity is new and the identifier value defaults to its initial value. That is 0 for primitive types and null if the identifier property uses a numeric wrapper type such as Long.
OptimisticLocking:
- The @Version annotation provides syntax similar to that of JPA in the context of R2DBC and makes sure updates are only applied to rows with a matching version.
Projections:
- https://docs.spring.io/spring-data/r2dbc/docs/current/reference/html/#projections
ReactiveAuditorAware with SpringSecurity:
Mapping Configuration:
- https://docs.spring.io/spring-data/r2dbc/docs/current/reference/html/#mapping.configuration