spring-data-rest

Spring-data-rest NullPointerException on OneToMany relationship

[亡魂溺海] 提交于 2019-12-11 23:15:39
问题 I'm developing an app with spring-data-rest. On each OneToMany relationship I have, when I try to access the elements of the collection using the link on the One side, I get a NullPointerException . I've reported this on the spring-data-rest Jira, and it's still unresolved. What I want to know is if someone has a OneToMany relationship that works properly on spring-data-rest, and the differences between the way the relationship is established on the working code and mine. Following, the java

Cannot create self link for class X. No persistent entity found

别说谁变了你拦得住时间么 提交于 2019-12-11 22:07:34
问题 Getting the error in the title when using Spring Data REST. How to resolve? Party.java: @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="@class") @JsonSubTypes({ @JsonSubTypes.Type(value=Individual.class, name="Individual") }) public abstract class Party { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) protected Long id; protected String name; @Override public String toString() { return id + " " + name; } ...getters, setters

Can we create custom Query using Spring Data REST while using @RepositoryRestResource?

一个人想着一个人 提交于 2019-12-11 18:42:22
问题 I am new to spring boot, I was trying to create a simple REST service using Spring-boot JPA. First I used simple @Repository which works fine, I can write custom Query method for the properties defined in my class. But when I use @RepositoryRestResource I am not able to create custom Query methods. Basic finding on primary key and other operations are happening but I can not create any custom Query. package com.example.demo.Model; import javax.persistence.Entity; import javax.persistence

Neo4J Rest Data Graph - using SpringData - connection refused exception

萝らか妹 提交于 2019-12-11 18:12:53
问题 I have a project that use successfully a Neo4J embedded data graph, using SpringData. I'm trying now to change it to REST database, with no success. I followed the (simple) instructions and it should have been really easy and straight forward, but I keep getting exceptions on server startup. I set the server, as in the examples, to http://localhost:7474/db/data/ and I get 'connection refused' when starting the Tomcat. I would like to mention that currently I'm running this code on my local PC

You have defined query method in the repository but you don't have any query lookup strategy defined

心不动则不痛 提交于 2019-12-11 15:42:21
问题 Yesterday this solution was working fine. Today I woke up to rerun the tests & it failed stating in the stacktrace that You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods! at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.(RepositoryFactorySupport.java:533) As clearly shown I did not define any query methods. :-( I'm stuck, I

Dynamic like query in spring data jpa

﹥>﹥吖頭↗ 提交于 2019-12-11 15:13:17
问题 Can a dynamic query be written in spring data rest as follows. If not then how to achieve a similar functionality: @Query("select s from Screen s where s.#searchColumn like:searchValue%") @RestResource(path="byString") Page findAll( @Param("searchColumn") String searchColumn, @Param("searchValue") String searchValue, Pageable pageable); 回答1: Solved Repo @Query("select o from Screen o where " + "(o.screenName like :val% and :prop = 'screenName') or " + "(o.address like :val% and :prop =

How to add resource and specify related element?

☆樱花仙子☆ 提交于 2019-12-11 13:57:57
问题 I have a simple API for a game tip website: /class is the endpoint for in game classes /tip is the endpoints for the tips /user is the endpoint for the users Each tip has 3 relations: (:User)-[:AUTHORED]-(:Tip) (:Class)<-[:FOR]-(:Tip) (:Class)<-[:AGAINST]-(:Tip) When I create a Tip using POST , I do'nt know how to add relations at the create time. I can do this way: Add relation to another node in SDN4 + REST after creating the resource, but I want to do it with only one query. EDIT: I tried

No suitable constructor found for type GeoJsonPoint

雨燕双飞 提交于 2019-12-11 13:11:35
问题 Having a lot of trouble figuring out what I'm doing wrong. Sadly I had it working at one point, but can't determine what I changed that broke it. From what I understand this should be fully supported now. Object in question: @Document public class Place { public final static String URI = "/place"; @Id private String id; private String name; private String caption; private GeoJsonPoint location; public Place() {} public Place(GeoJsonPoint geoJsonPoint) { this.location = geoJsonPoint; } //

Missing links in Spring Data Rest projection

可紊 提交于 2019-12-11 11:33:55
问题 I am working with Spring Data Rest and Hibernate in my current project. I just added projections for some entities to reduce the amount of calls to the backend when displaying information. My code looks like this: Component.class @NoArgsConstructor @RequiredArgsConstructor @EqualsAndHashCode @Getter @Setter @Slf4j @Entity @Table(name = "components") public class Component { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "component_id", unique = true) private Long id;

Spring Data Rest one to many JSON Formatting: Use foreign key instead of objects

主宰稳场 提交于 2019-12-11 11:12:09
问题 Im using spring boot with 2.0.0.M6 with kotlin 1.1.51 with org.springframework.boot:spring-boot-starter-data-rest and trying to format output of json. How can i config. spring rest data so that it will output/accept foreign key instead of object with href in a ManyToOne-Relationship? sample model with foreign key language_id (kotlin): @Entity data class Song ( @Column var title: String, @Column var songTypeId: Int, @OneToMany(mappedBy = "song") var mastersheets: Set<Mastersheet> = setOf