I have a database service using Spring Boot 1.5.1 and Spring Data Rest. I am storing my entities in a MySQL database, and accessing them over REST using Spring\'s PagingAndS
I debugged through that and it looks like the issue that Alan mentioned.
I found workaround that could help:
Create own controller, inject your repo and optionally projection factory (if you need projections). Implement get method to delegate call to your repository
@RestController
@RequestMapping("/people")
public class PeopleController {
@Autowired
PersonRepository repository;
//@Autowired
//PagedResourcesAssembler resourceAssembler;
@GetMapping("/by-address/{addressId}")
public Page getByAddress(@PathVariable("addressId") Long addressId, Pageable page) {
// spring doesn't spoil your sort here ...
Page page = repository.findByAddress_Id(addressId, page)
// optionally, apply projection
// to return DTO/specifically loaded Entity objects ...
// return type would be then PagedResources>
// return resourceAssembler.toResource(page.map(...))
return page;
}
}
This works for me with 2.6.8.RELEASE; the issue seems to be in all versions.