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

Support Optionals in repository methods [DATAREST-511] #885

Closed
spring-projects-issues opened this issue Apr 9, 2015 · 1 comment
Closed
Assignees
Labels
type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Robert Verdes opened DATAREST-511 and commented

A Repository method like:

User findFirstByName(@Param("name") String name); 

works well with issuing a /search/findFirstByName?name=foo,
but when using an Optional as a return type:

Optional<User> findFirstByName(@Param("name") String name); 

as per documentation:

for the queries limiting the result set to one instance, wrapping the result into an Optional is supported.

we get the "PersistentEntity must not be null!" exception


Affects: 2.3 GA (Fowler)

Backported to: 2.3.1 (Fowler SR1)

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

Qualified as improvement as Spring Data REST hasn't supported Optional yet. I can't find the quote you mention in the Spring Data REST reference documentation.

However, his has been fixed and back-ported to the Evans maintenance branch. Feel free to give the snapshots a try

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

No branches or pull requests

2 participants