spring-data-r2dbc icon indicating copy to clipboard operation
spring-data-r2dbc copied to clipboard

Consider converters for OptionalInt, OptionalLong, and OptionalDouble

Open mp911de opened this issue 5 years ago • 2 comments

Since primitive null values are not emitted as query result (see #469), we should consider adding support for optional primitive projections such as OptionalInt. These types allow reasoning about the target type and their value may be absent while still emitting a result object. This may be required when the result order matters.

interface MyRepository extends ReactiveCrudRepository<MyEntity, Integer> {

    @Query("SELECT age FROM my_table ORDER BY first_name")
    Flux<OptionalInt> findMaxAge();
}

mp911de avatar Oct 02 '20 08:10 mp911de

Can you please assign this issue to me?

vasantteja avatar Feb 14 '21 21:02 vasantteja

For the time being, this ticket should be probably handled in Spring Data Commons to enable other store modules to consume results as OptionalInt etc.

mp911de avatar Feb 15 '21 07:02 mp911de