hypermedia

How to retrieve entity relationships after save?

一个人想着一个人 提交于 2021-02-05 03:24:27
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

How to retrieve entity relationships after save?

柔情痞子 提交于 2021-02-05 03:23:01
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

How to retrieve entity relationships after save?

感情迁移 提交于 2021-02-05 03:21:07
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

JSON Hypermedia Api with forms and links

无人久伴 提交于 2020-01-10 07:58:08
问题 I am in the early stages of planning a REST api, and I would like for it to adhere to the HATEOAS constraint of REST. But I would also like to provide a JSON format. So my question is if there are conventions out there to represent links and forms in JSON. I have found examples of links, and it looks like this is a pretty common way of representing links: "links": [ {"rel": "self", "href":"http://example.org/entity/1"}, {"rel": "friends", "href":"http://example.org/entity/1/friends"}]

Optionally disable HATEOAS format in Spring Data Rest

雨燕双飞 提交于 2019-12-18 18:52:08
问题 So let's say I have an existing application that has two endpoints /people and /pants. Calling GET /people returns: [ { "name":"john", "age":37, "pants":[ { "color":"green", "brand":"levis", "size":"medium" }, { "color":"indigo", "brand":"jncos", "size":"medium-with-huge-legs" } ] }, { "name":"june", "age":23, "pants":[ { "color":"pink", "brand":"gap", "size":"small" } ] } ] If i were to use Spring Data Rest and call GET /person i'd receive something like: { "_links":{ "next":{ "href":"http:/