Spring Data REST (and Spring HATEOAS in particular) decouples RESTful IDs (viz., URIs) from entity IDs, and I\'m having trouble linking them back up when saving new objects.
Have you looked at https://github.com/SpringSource/spring-data-rest/wiki/Embedded-Entity-references-in-complex-object-graphs?
Simply put, the exporter will de-reference Link objects if it finds them in place of a relationship or managed object (another entity that has an exported Repository).
Assuming your linked property is called "category", then you could create a new Ticket like:
POST /tickets
Content-Type: application/json
{
"description": "Description of the ticket or issue",
"category": {
"rel": "category.Category",
"href": "http://localhost:8080/categories/1"
}
}
Apprently in the newer versions of Spring Data Rest, this should do it:
POST /tickets
Content-Type: application/json
{
"description": "Description of the ticket or issue",
"category": "http://localhost:8080/categories/1"
}
Going by Oliver Gierke's comment at Spring Data Rest 2.0.0.RELEASE Breaks Code Working Previously With RC1