Skip to content

Support returning Optional<?> and empty Collections instead of throwing EmptyResultDataAccessException/IncorrectResultSizeDataAccessException #27

@ryonday

Description

@ryonday

The current spring-data-dynamodb throws EmptyResultDataAccessException or IncorrectResultSizeDataAccessException when queries fail. As these are unchecked exceptions, it really makes my jaw drop when it happens unexpectedly since most times these are recoverable errors for my codebase.

Recently, I've been switching my code over to using the Optional<T> monad, and Spring has touted support for this in new versions of spring-data. It is much more developer friendly to return these wrapper types for single-item queries and to return empty Collection/Iterable for empty multi-item queries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions