Questions tagged [spring-data-rest]

Spring Data REST (SDR) is a Spring Data project that aims to make it easy to expose Spring Data repositories as REST services. SDR use Spring HATEOAS internally to create HAL response.

2228 questions
12
votes
2 answers

Repository access control in Spring Data Rest based off user princpal

I'm attempting to implement fine grain access control while still taking advantage of Spring data rest. I'm working on securing a CrudRepository so users can only modify or insert data that belongs to them. I'm making use of…
francis
  • 5,889
  • 3
  • 27
  • 51
12
votes
1 answer

Spring Data REST - Detected multiple association links with same relation type

I am trying to doing a simple Spring app. It needs to expose REST endpoints and save it to a relational database. I took your sample project, http://spring.io/guides/gs/accessing-data-rest/. I am able to do all the operations( POST, PATCH, PUT, GET)…
user827096
  • 565
  • 1
  • 6
  • 11
12
votes
3 answers

using validators in spring-data-rest returns http 500 instead of 400

I'm trying to get the validation in spring-data-rest to work. From the documentation you only need to make a validator available, and I've got that to work, but when a validation constraint is successfully caught/processed I get a 500 error page…
wenic
  • 1,169
  • 2
  • 14
  • 23
12
votes
1 answer

Spring Data Rest Pageable Child Collection

I have an @Entity called User. It has a Set of Changesets as follows: @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, mappedBy="user") private Set changesets = new HashSet(); I have a…
12
votes
2 answers

How can I handle exceptions with Spring Data Rest and the PagingAndSortingRepository?

Let's say I have a repository like: public interface MyRepository extends PagingAndSortingRepository { @Query("....") Page findByCustomField(@Param("customField") String customField, Pageable pageable); } This…
cbmeeks
  • 11,248
  • 22
  • 85
  • 136
11
votes
2 answers

Javers - What are advantages of using Javers instead of Envers?

I am developing a RESTful API using Spring Data REST. Now for auditing, Spring does have the option to auditing meta data like created_date and modified_date but they don't provide entity versioning. Currently there are two popular libraries for…
Charlie
  • 3,113
  • 3
  • 38
  • 60
11
votes
3 answers

spring data rest with composite primary key

I use spring data rest for crud. But when the entity has composite primary keys, I dont know how to to get an entity by giving the primary key. River class: @Entity public class River { private RiverPK id; private Double length; private…
kidfruit
  • 364
  • 1
  • 2
  • 9
11
votes
1 answer

Modify @OneToMany entity in Spring Data Rest without its repository

In my project I use object of type A which has OneToMany relation (orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.EAGER) to objects of type B. I need SpringDataRest (SDR) to store complete full A object with its B objects…
rotmajster
  • 111
  • 1
  • 6
11
votes
3 answers

Spring JPA REST One to Many

I wanted to extend the example Accessing JPA Data with REST by adding an address list to the Person entity. So, I added a list addresses with @OneToMany annotation: @Entity public class Person { @Id @GeneratedValue(strategy =…
Aris F.
  • 1,105
  • 1
  • 11
  • 27
11
votes
8 answers

Securing exclusively the REST access to a Spring Data Rest Repository

I'm using Spring Data Rest to expose a repository. I'm using @PreAuthorize and @PostFilter to restrict the access to the REST end points to exclusively admin users and filter the…
Gerardo
  • 195
  • 1
  • 13
11
votes
4 answers

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/ I need to set a flag on the database marking that entity as deleted but i do…
ejoncas
  • 329
  • 2
  • 13
11
votes
2 answers

Getting duplicate items when querying a collection with Spring Data Rest

I'm having duplicate results on a collection with this simple model: an entity Module and an entity Page. A Module has a set of pages, and a Page belongs to the module. This is set up with Spring Boot with Spring Data JPA and Spring Data Rest. The…
alejo
  • 317
  • 3
  • 10
11
votes
3 answers

Spring Boot @WebIntegrationTest and TestRestTemplate - Is it possible to rollback test transactions?

I have a Spring Boot application with Spring Data Rest and I use @WebIntegrationTest along with the TestRestTemplate in my integration tests. The base class for the tests looks something like…
11
votes
2 answers

How to add elements in a many-to-many relationship via Spring's @RepositoryRestResource REST API?

I'm having trouble figuring out exactly how to use the @RepositoryRestResource interface to create many-to-many relationships between two fairly simple entities. For example, I have a simple parent-child entity relationship like this: @Entity public…
Shawn Sherwood
  • 1,968
  • 2
  • 19
  • 30
11
votes
1 answer

Spring Data Rest: Expose new endpoints for Repository that extends Revision Repository

I would like to expose new endpoints for my repository which also extends RevisionRepository. @RepositoryRestResource(collectionResourceRel = "persons", itemResourceRel = "person", path = "persons") public interface PersonRepository extends…
Chad
  • 2,041
  • 6
  • 25
  • 39