Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The FindById and findByIdAndPartitionKey implementation don't comply with javadoc #451

Closed
apescione opened this issue Oct 25, 2019 · 3 comments
Assignees
Labels

Comments

@apescione
Copy link

apescione commented Oct 25, 2019

Version: 2.1.8

Both APIs FindById and findByIdAndPartitionKey should return Optional#empty() when a Entity hasn't been found, instead, a DocumentDBAccessException is thrown.

Below the documentation for findByIdAndPartitionKey in com.microsoft.azure.spring.data.cosmosdb.repository.DocumentDbRepository<T, ID>

    /**
     * Retrieves an entity by its id.
     *
     * @param id must not be {@literal null}.
     * @param partitionKey partition key value of entity, must not be null.
     * @return the entity with the given id or {@literal Optional#empty()} if none found
     * @throws IllegalArgumentException if {@code id} is {@literal null}.
     */
    Optional<T> findById(ID id, PartitionKey partitionKey);

This behavior will force to catch always the exception when an entity is not found.
DocumentDBAccessException may be thrown when other kind of errors occur.

@kushagraThapar kushagraThapar self-assigned this Oct 25, 2019
@kushagraThapar
Copy link
Collaborator

Verified at our end, findById API is behaving correctly, but findById which takes partitionKey as well has this bug. Will fix it soon.

This was referenced Dec 23, 2019
@kushagraThapar
Copy link
Collaborator

kushagraThapar commented Dec 26, 2019

@ apescione
This has been fixed and released in v2.1.9.

Will be fixed and released in v2.2.1.M2 in few days. .

@kushagraThapar
Copy link
Collaborator

This has been fixed in v2.2.1 as well. Closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants