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

can't get SpringBoot and JPA to return 404 for missing entity. #423

Open
adhamhf opened this issue May 5, 2017 · 1 comment
Open

can't get SpringBoot and JPA to return 404 for missing entity. #423

adhamhf opened this issue May 5, 2017 · 1 comment
Labels

Comments

@adhamhf
Copy link

adhamhf commented May 5, 2017

Based on the JSON:API spec, if I ask for an entity that does not exist I should get a 404.

When using the spring-boot-simple-example I can only get {"data":null}.

curl http://localhost:8080/api/schedule/1 
   -> {"data":null}%

however, when using one of the non-JPA entities in the sample I get the expected result:

curl http://localhost:8080/api/tasks/10000 
  -> {"errors":[{"status":"404","title":"Project not found!","detail":"Project not found!"}]}

@remmeier it looks like you updated the sample for JPA. Do you have any thoughts?

@adhamhf
Copy link
Author

adhamhf commented May 8, 2017

I think the issue is that JpaEntityRepository is not throwing ResourceNotFoundExceptions in findOne or findAll. Also, I think it would be nice if JpaRepositoryFactory relied on an interface instead of the concrete class JpaEntityRepository. This would make it much easier for me to provide an alternative implementation. Right now I have I have to subclass JpaEntityRepository, some of these methods are final it makes a work around ackward.

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

3 participants