We now differentiate the result mapping based on projection type and query type. Previously, all projections used the domain type to map results first and then serve as backend for the projection proxy/DTO creation.
We now use direct result to DTO mapping for String-based queries to allow for a greater flexibility when declaring DTO result types. Interface-based projections and derived queries remain using the two-step process of result to domain type mapping and then mapping the domain type into the projection.
We now invoke the converter for query arguments of String-based queries (using the Query annotation or named queries) to convert the value into a type that can be used by the driver.
Previously all values were passed-thru which caused for e.g. enums to pass-thru these to the driver and the driver encode failed.
Results projected onto simple and primitive types that are null are no longer emitted.
A SQL query SELECT MAX(age) FROM my_table that returns a SQL NULL and that would be consumed as Long.class (Publisher<Long>) is an example for a primitive type that can be null. Since Reactive Streams prohibits the propagation of null values by a Publisher to a Subscriber the only viable option is to suppress null results by wrapping the mapping function into Optional result values and filter these values later to avoid null being emitted.
We now map results of exists queries to a boolean flag to ensure proper decoding. Previously, results were attempted to be mapped onto a primitive type which failed as there's no converter registered for Row to Boolean.
R2DBC Postgres Geo-types are now considered simple types that are passed-thru to the driver without further mapping. Types such as io.r2dbc.postgresql.codec.Circle or io.r2dbc.postgresql.codec.Box can be used directly in domain models and as bind parameters.
We now propagate auto-generated Id values to primitive Id properties if the value in the domain model is zero. This happens in addition to non-primitive values being null to ensure that generated values end up in the domain model.
Removed the language of oppression and violence
and replaced it with more neutral language.
Note that problematic words in the code have
to remain in the docs until the code changes.
We now initialize/increment the version of versioned entities (optimistic locking) after running the BeforeConvert callback. BeforeConvert callbacks may contain features such as auditing and if the auditing callback issues a isNew check, then the version would be already populated which leads to the auditing callback considering the entity not new anymore leaving the created date empty.
We now support the use of @Value in persistence constructors to compute values for constructor creation.
class MyDomainObject {
public MyDomainObject(long id, @Value("#root.my_column") String my_column, @Value("5+2") int computed) {
// …
}
}
ReactiveDataAccessStrategy is now deprecated in favor of using StatementMapper, UpdateMapper, and R2dbcConverter directly. The access strategy interface was introduced to allow pluggable access strategies in DatabaseClient. With moving DatabaseClient into Spring Framework, this approach is no longer required.
We now create R2dbcEntityTemplate as part of R2dbcRepositoryFactoryBean initialization if the factory bean was configured with DatabaseClient and DataAccessStrategy only. Creating the template in the factory bean allows collecting entity callbacks for repository usage.
We now provide EnumWriteSupport as base class for enum write converters that should be written as-is to the driver.
R2dbcCustomConversions can now also be created from a dialect for easier R2dbcCustomConversions creation.
We now exclude Id properties from being used in the INSERT field list if the Id value is zero and of a primitive type or if the value is null using a numeric wrapper type.
Line breaks after dots in ascii doctor file for easier reading of the source files.
Adds specific deprecation links instead of just links to the general package.
Removes an unused private method in `ConnectionFactoryUtils`
Original pull request: #412.