spring-data-rest

Override findAll() Spring Data Gemfire Repo Queries

心已入冬 提交于 2019-12-25 08:08:33
问题 I have millions of objects populated in GemFire regions. I don't want default findAll() SDR query to be executed to retrieve the millions of objects in one shot. I am trying to figure out if there is a way to override the default findAll query and provide the LIMIT param to restrict the number of objects retrieved from GemFire Regions. Here is an example of what I want to do: NoRepositoryBean public interface CrudRepository<T, ID extends Serializable> extends Repository<T, ID> { /** * Returns

Spring Getting Started Guide “Accessing JPA Data with REST” not working

安稳与你 提交于 2019-12-25 07:14:28
问题 I'm learning Spring using the Getting Started Guides. Right now I'm trying to complete "Accessing JPA Data with REST" guide but my code didn't work, so I tried the "complete" version, and it doesn't work too. So far everytime I import content using Spring Tool Suite (STS), the "complete" version executes as expected, according to the description in the guides, but it's not happening right now. The guide instructs me to run the Project as a "Spring Boot App", then to execute a curl command to

Blank Screen even though log has results for @ManyToOne Lazy associated resource

南楼画角 提交于 2019-12-25 06:50:40
问题 I am using following dependencies - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>4.1.3.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>1.8.0.M1</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId> <version>2.3.0.BUILD-SNAPSHOT<

Issue with projection in SpringDataRest and @Lob attribute

夙愿已清 提交于 2019-12-25 06:21:58
问题 I have an Entity Person : @Entity public class Person implements Serializable { @Id @GeneratedValue(strategy = AUTO, generator = "PERSON_SEQ") private Integer idPerson; private String lastName; private String firstName; @Lob private byte[] picture; A repository public interface PersonRepository extends PagingAndSortingRepository<Person, Integer> {} A projection @Projection(name = "picture", types = { Person.class }) public interface ProjectionPicturePerson { byte[] getPicture(); } When i used

RestTemplate POSTing entity with associations to Spring Data REST server

拜拜、爱过 提交于 2019-12-24 16:39:50
问题 The problem I have three entities (taken from the Spring Data REST Exporter Example): Person, Address and Profile. A Person can have addresses and profiles. @Entity public class Person { @Id @GeneratedValue private Long id; private String name; @Version private Long version; @OneToMany private List<Address> addresses; @OneToMany private Map<String, Profile> profiles; // getters and setters } In the client side I use Spring's RestTemplate. I added the Jackson2HalModule to the ObjectMapper used

Spring Boot REST Resource not showing linked objects (sets)

﹥>﹥吖頭↗ 提交于 2019-12-24 15:59:29
问题 I've a database and some classes. These classes are linked with OneToMany , and so on. If I print the object itself with spring it contains everything. But if I print it with the Resource feature, it contains only the variables, which are no collections or linked otherwise with an other class. How can I add the collections to the output? 回答1: By default Spring Data REST does not show associated resources except as links. If you want that you have to define projections that describe the fields

NullPointerException when making an OPTIONS request with Access-Control-Request-Method in Spring-data-rest

本秂侑毒 提交于 2019-12-24 15:49:49
问题 I get the following exception when making an OPTIONS request: java.lang.NullPointerException: null at org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping.exposeEffectiveLookupPathKey(RepositoryRestHandlerMapping.java:264) ~[spring-data-rest-webmvc-3.1.3.RELEASE.jar:3.1.3.RELEASE] at org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping.lookupHandlerMethod(RepositoryRestHandlerMapping.java:165) ~[spring-data-rest-webmvc-3.1.3.RELEASE.jar:3.1.3.RELEASE] at org

global exception handling for rest exposed spring-data

梦想的初衷 提交于 2019-12-24 13:11:24
问题 Using spring-data-rest to expose repositories i want to overwrite the default exception handling. reading documentation it looks to me that the best wat would be using a @ControllerAdvice annotated class @ControllerAdvice class GlobalControllerExceptionHandler extends ResponseEntityExceptionHandler { Logger log = LoggerFactory.getLogger(GlobalControllerExceptionHandler.class); @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) @ExceptionHandler(Exception.class) public ResponseEntity

What are the advantages of using Spring Data REST over Spring Data JPA?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 12:10:09
问题 I know that spring data rest will export your repositories as REST services..but i want to know advantages of that over use of spring data jpa. 回答1: This is a fruit-salad-to-buffet comparison as the technologies solve completely different problems: Spring Data JPA eases working with JPA on top of Spring. It exposes a repository programming model which allows you to build Java APIs to access data in relational databases. Spring Data REST builds on top of the repository abstraction (not being

Overriding Spring Data Rest Request Mappings

佐手、 提交于 2019-12-24 03:27:41
问题 We currently have a level 2 RESTful web service. We are updating the service to incorporate hypermedia support. We are using Spring Data Rest on the back-end to handle the setting of the HATEOAS properties. The problem we're having is that we still need to support our legacy API consumers until the migration can be completed, meaning we still need to support responses without HAL properties like "_links" and "_embedded". For reasons that aren't really worth explaining, we cannot address this