Now I know how to findBySomething on root level entity. Let’s say I have a one to many relation of class -> student I can now students/search/findByName?name=Tom But it will give me Tom in all classes. Can I do something like classes/1/students/search/findByName?name=Tom It gives error right now. Answer in StudentController in StudentService in StudentRepository (I use mongoDB; if u use
Tag: spring-data-rest
Spring Boot 2.3.x – How to apply a projection in a custom @RestController?
I am trying to apply projection on an entity returned from a custom controller annotated @RestController. But I am getting an infinite recursion exception This code works fine in Spring Boot 1.5.17 (I can apply projections and even get HAL formatted JSON) but it breaks in Spring 2.3.x. So what I essentially want is the functionality of a Spring Data
Column ‘foreign_key_id’ cannot be null
I have a rest api exposed via @RepositoryRestResource from spring-data-rest-api. When I try to give the json payload from Postman to create a User linked to an Organization, it complains that Column ‘organizationId’ cannot be null, when I clearly provided it in the json. Each user belongs to an organization, so it’s a many to one relationship. I want Java
“org.springframework.data.util.TypeInformation.getActualType()” because “propertyType” is null
A Spring Boot 2.5.1 application is logging this warning: whereas Spring Boot 2.4.4 does not. The POJO is trivial: and the Spring RestController is similarly: To trigger the warning submit a POST: The warning is triggered while “handling” the _links property of the EntityModel<SoPojo> but why and what can I do about it. Any ideas? Update: As dkb notes, this
Add database authentication to Spring Data Rest application
I’m creating an application using Spring Data REST with Thymeleaf. Initially I created my models, controllers, dao and services. All worked fine. I’m now trying to add security to my application. …
How to properly access a secured Spring Data REST Repository in a ApplicationRunner?
I followed the documentation on how to secure REST repositories with @PreAuthorize. However, the following repository @PreAuthorize(“hasRole(‘ROLE_ADMIN’)”) @RepositoryRestResource public interface …
Spring Data Rest – Soft Delete
I’ve been using spring data rest without any problem but now I have a requirement that when a user performs a DELETE operation on a given entity i.e. DELETE /accounts/<id> I need to set a flag on the database marking that entity as deleted but i do want to keep the record. Basically this means that I need to do