0

I'm working in my learn project with AngularJS and Spring Rest Data. I have the database tables Reservation and Client, a Reservation has a Client, perfect ... the JSON response for a Reservation query is the next: rest api response for reservation

In yellow, it's the Client URL reference, I want to know if there any way to load this Client object to the response, some like the Jackson way (load the object and the intern object data, not a link), I know that it's the way with Spring Rest Data, but I'm confused by the way in that I should do this.

In my Angular Controller I have this: enter image description here

And, in the view (I wish .. ) I load the client data, but obviously not have data (because I didn't query the client link)

enter image description here

The client view (table) looks like this (client data not shown) enter image description here

Please help me :) Thanks a lot!

Rosendo Ropher
  • 496
  • 8
  • 21
  • [Here](http://stackoverflow.com/questions/23264044/spring-data-rest-disable-hypertext-application-language-hal-in-json-applica) is link to similar problem. You have to disable HAL media type. – borysfan Sep 23 '15 at 20:49

1 Answers1

2

You can use @Projection class to get relationship table data. Projection class allow change JSON response format. As below picture, I can get project's data related with sprint.

enter image description here

I create SprintProjection class:

enter image description here

And I add projection class to Repository:

enter image description here

Here is source code sample: https://github.com/spring-projects/spring-data-examples/tree/master/rest/projections

Huy Nguyen
  • 424
  • 3
  • 10