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
16
votes
5 answers

Spring Data Rest: "Date is null" query throws an postgres exception

I use Spring Boot and Data Rest to create a simple microservice in Java8 and get a postgres exception. My entity: @Entity public class ArchivedInvoice implements Serializable { ... @Column private String invoiceNumber; @Column …
user2722077
  • 462
  • 1
  • 8
  • 21
16
votes
2 answers

Exception using Spring Data JPA and QueryDsl via REST Controller

I'm trying to implement a controller method similar to how is documented in the latest Gosling release train of Spring Data that supports QueryDsl. I've implemented the controller as shown in the example in the docs at…
16
votes
3 answers

How to add links to root resource in Spring Data REST?

How to expose an external resource (not managed through a repository) in the root listing of resources of Spring Data REST? I defined a controller following the pattern in Restbucks
Stackee007
  • 3,196
  • 1
  • 26
  • 39
15
votes
2 answers

QueryDsl web query on the key of a Map field

Overview Given Spring Data JPA, Spring Data Rest, QueryDsl a Meetup entity with a Map properties field persisted in a MEETUP_PROPERTY table as an @ElementCollection a MeetupRepository that extends…
Eric J Turley
  • 350
  • 1
  • 5
  • 20
15
votes
2 answers

How to exclude a @Repository from component scan when using Spring Data Rest

in a spring boot project I have problems to exclude some repositories from the component scan. I have a library that contains some entities and some repositories (JpaRepositories). For some reason I implemented a small Spring Boot Data Rest…
magomi
  • 6,599
  • 5
  • 31
  • 38
15
votes
1 answer

spring data rest update produce cross join sql error

I want to use spring data rest to update rows of certain user , but at run time this query has strange "cross join" added to the query . spring data rest method @Modifying @Transactional @Query("Update Notification n SET n.noticed = true Where…
user1021743
  • 477
  • 4
  • 16
15
votes
2 answers

Mixing Spring MVC + Spring Data Rest results in odd MVC responses

I have a two JPA entities, one with a SDR exported repository, and another with a Spring MVC controller, and a non-exported repository. The MVC exposed entity has a reference to the SDR managed entity. See below for code reference. The problem…
bvulaj
  • 5,023
  • 5
  • 31
  • 45
15
votes
6 answers

Spring Boot LocalDate field serialization and deserialization

In Spring Boot 1.2.3.RELEASE with fasterxml what is the correct way of serializing and de-serializing a LocalDate field to ISO date formatted string? I've tried: spring.jackson.serialization.write-dates-as-timestamps:false in application.properties…
aycanadal
  • 1,106
  • 2
  • 15
  • 42
15
votes
4 answers

Can JSR 303 Bean Validation be used with Spring Data Rest?

I understand from the docs http://docs.spring.io/spring-data/rest/docs/2.1.2.RELEASE/reference/html/validation-chapter.html that I can declare validators with certain prefixes. I'm using JSR 303 so my domain entities are annotated with validation…
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
15
votes
3 answers

Swagger With Spring-Data-Rest

Has anyone configured swagger with spring-data-rest. I know swagger has DocumentationConfig class which scans for all spring-mvc request mappings. But, how to use that for spring-data-rest as there are no explicit request mappings defined. Any help…
user1917034
  • 401
  • 5
  • 11
14
votes
3 answers

Spring Data JPA - Get All Unique Values in Column

I have a project using Spring Data JPA that consumes data from a table full of addresses. One of the columns of this table is the city. I would like to get a distinct list of cities that are in the table i.e. SELECT DISTINCT city FROM address. Is…
Samantha Catania
  • 5,116
  • 5
  • 39
  • 69
14
votes
1 answer

How to return deep nested projections in Spring data rest?

Given this 3 entities: @Entity class Department{ Set employees; Set getEmployees(){ return this.employees; }; } @Entity class Employee{ Nationality nationality; Nationality getNationality(){ …
Songo
  • 5,618
  • 8
  • 58
  • 96
14
votes
3 answers

Spring Data Rest Validation Confusion

Looking for some help with Spring data rest validation regarding proper handling of validation errors: I'm so confused with the docs regarding spring-data-rest validation here:…
1977
  • 2,580
  • 6
  • 26
  • 37
14
votes
3 answers

Upsert Mongo Document using spring data mongo

I have a Class @Document public class MyDocument { @Id private String id; private String title; private String description; private String tagLine; @CreatedDate private Date createdDate; @LastModifiedDate private Date…
14
votes
2 answers

How to customize Spring Data REST to use a multi-segment path for a repository resource?

I'm developing a component based CRUD application using Spring Data JPA and Spring Data REST. I have several components. For example system component has the User model and the UserRepository. Components are differenciated by the package names. like…
Faraj Farook
  • 14,385
  • 16
  • 71
  • 97