I have two JPA Entities (Patient and Clinic) with OneToMany ManyToOne relationship. I would like to return the data in JSON format (currently with org.apache.cxf.jaxrs.provider.JSONProvider
). Below is a patient info and its associated clinic. However, it returns all fields for clinic. How could I just return primary key/id (@Id) for the clinic?
{
"Patient": {
"age": 0,
"clinic": {
"address": "long address here",
"otherKeys": "other values",
"id": 5
},
"ic": "010101",
"id": 12,
"name": "Patient 01"
}
}