Created
January 15, 2020 09:20
-
-
Save FroMage/fd9737ad20dfd9c3fca00d4e59067fba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Person { | |
@Id | |
@GeneratedValue | |
private long id; | |
private String name; | |
private boolean married; | |
private Address address; | |
@ManyToOne | |
private Company company; | |
// constructors and getters | |
} | |
The resulting JSON response will be like this: | |
{ | |
“_links": { | |
“self": { | |
“href": “http://localhost:8080/persons/1" | |
}, | |
“person": { | |
“href": “http://localhost:8080/persons/1" | |
}, | |
“company": { | |
“href": “http://localhost:8080/companies/1" | |
} | |
}, | |
“name”: “Jonas”, | |
“married”: “true”, | |
“address”: { | |
“country”: “Lithuania”, | |
“city”: “Vilnius" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment