Announcement Announcement Module
Collapse
No announcement yet.
Spring Data Rest-search with id not existed in db Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Rest-search with id not existed in db

    Hi I'm using Spring-data-rest

    Created Person entity and PersonRepository

    public interface PersonRepository extends CrudRepository<Person, Long> {

    @RestResource(path = "id")
    public List<Person> findById(@Param("id") Long id);

    }

    From the above code, if I search with id number that is not existed in the database, returns Json code like:

    { "results" : [ ], "totalCount" : 0, "totalPages" : 1, "currentPage" : 1, "_links" : [ ] }

    It should be better if it returns an exception like 204 or no values in db.

    Please suggest..
Working...
X