spring-data-rest

Using arbitrary query as projection in spring data rest project

倾然丶 夕夏残阳落幕 提交于 2020-04-11 12:43:06
问题 How it is possible to use arbitrary sql query (I mean native sql query) in some repository? My actual problem is this: @Data //lombok thing @Entity public class A extends AuditModel { private long id; private String name; @OneToMany(mappedBy="a") //Comments.a is owning side of association, i.e. comments table does have column called a_id as foreign key @ToString.Exclude private Set<Comments> comments = new HashSet(); @OneToMany(mappedBy="a") //SimpleFile.a is owning side of association

Migrating ResourceProcessor to HATEOAS 1.0.0 M1

你离开我真会死。 提交于 2020-03-23 07:22:07
问题 In my current Spring HATEOAS 0.25.1.RELEASE project I make heavy use of ResourceProcessor interfaces: @Bean public ResourceProcessor<Resource<Person>> personProcessor() { return new ResourceProcessor<Resource<Person>>() { @Override public Resource<Person> process(Resource<Person> resource) { resource.add(new Link("http://localhost:8080/people", "added-link")); return resource; } }; } How can can I migrate my ResourceProcessors to Spring HATEOAS 1.0.0 M1? 回答1: In Spring HATEOAS 1.0 M1, a lot

Does Spring Data REST event hanlders use separate database transactions?

这一生的挚爱 提交于 2020-03-05 06:06:54
问题 Spring Data REST has the following Event handlers which are fired on HTTP requests like POST, PUT etc. @RepositoryEventHandler(Author.class) public class AuthorEventHandler { Logger logger = Logger.getLogger("Class AuthorEventHandler"); @HandleBeforeCreate public void handleAuthorBeforeCreate(Author author){ logger.info("Inside Author Before Create...."); } @HandleAfterCreate public void handleAuthorAfterCreate(Author author){ logger.info("Inside Author After Create ...."); } } My question is

Swagger not detecting Api built with Spring Data Rest

可紊 提交于 2020-02-24 17:52:30
问题 I'm working on a spring boot application using swagger to generate docs for my API ,I'm using Spring data rest to generate the Api but when I run the app I get the swagger message : No operations defined in spec! This my Api code : @Api(tags = "projets") @RepositoryRestResource(collectionResourceRel = "projets", path = "projets") public interface IProjectRepository extends JpaRepository<Project, Long> { } And this my configuration file : @Configuration @EnableSwagger2 public class

How to save many objects in the same request using Spring Boot Data Rest

不羁岁月 提交于 2020-02-21 05:59:25
问题 I'm try save a array of an Entity using POST method passing an array for rest resource, but I have an error: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of br.com.servtech.almox.model.Item out of START_ARRAY token at [Source: org.apache.catalina.connector.CoyoteInputStream@2af1e451; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of br.com

How to save many objects in the same request using Spring Boot Data Rest

纵然是瞬间 提交于 2020-02-21 05:59:21
问题 I'm try save a array of an Entity using POST method passing an array for rest resource, but I have an error: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of br.com.servtech.almox.model.Item out of START_ARRAY token at [Source: org.apache.catalina.connector.CoyoteInputStream@2af1e451; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of br.com

Spring Data rest how to perform CRUD on @manytomany relation ,composite table with extra column

大城市里の小女人 提交于 2020-02-10 12:09:54
问题 I am unable to perform CRUD via json POST from restful client Postman on Composite table having extra column .I am using Spring boot ,spring data rest and spring JPA. I have 3 tables in data base -user -competency -user_competency (join/composite table with extra column) Here are my classes User @Entity @Table(name = "\"user\"", schema = "public") @JsonIdentityInfo( generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "userId") public class User implements java.io

Spring Data rest how to perform CRUD on @manytomany relation ,composite table with extra column

天大地大妈咪最大 提交于 2020-02-10 12:09:49
问题 I am unable to perform CRUD via json POST from restful client Postman on Composite table having extra column .I am using Spring boot ,spring data rest and spring JPA. I have 3 tables in data base -user -competency -user_competency (join/composite table with extra column) Here are my classes User @Entity @Table(name = "\"user\"", schema = "public") @JsonIdentityInfo( generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "userId") public class User implements java.io

Spring Data Rest - How to remove an element from a Page?

我是研究僧i 提交于 2020-02-05 07:19:09
问题 I have the following REST controller method in my project @RequestMapping(method = GET, value = "applications", produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody ResponseEntity<?> getApplications(@QuerydslPredicate(root = Application.class) Predicate predicate, PersistentEntityResourceAssembler resourceAssembler, Pageable page) { Page<ApplicationProjection> applications = appRepo.findAll(predicate, page). map(item -> projectionFactory.createProjection(ApplicationProjection

Spring Data Rest - How to remove an element from a Page?

跟風遠走 提交于 2020-02-05 07:18:10
问题 I have the following REST controller method in my project @RequestMapping(method = GET, value = "applications", produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody ResponseEntity<?> getApplications(@QuerydslPredicate(root = Application.class) Predicate predicate, PersistentEntityResourceAssembler resourceAssembler, Pageable page) { Page<ApplicationProjection> applications = appRepo.findAll(predicate, page). map(item -> projectionFactory.createProjection(ApplicationProjection