I have this issue, when I try to return an object from my API, sometimes the format is as an object and other times it's just the ID of that object. I need it to always return the object. I've noticed that it only happens if the object it relates to has the same ID as another object already in the list. In this case, the first time it comes out as a "myClass" object and the second time, only with its ID value "3". Any solution for this?
class:
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id", resolver = EntityIdResolver.class, scope = MyClass.class)
public class MyClass{....}
RESPONSE
{
"itemList": [
{
"id": 70110,
"myClass": {
"id": 3,
"name": "itemName",
"date": "2000-01-01"
},
},
{
"id": 70111,
"myClass": 3,
}
]
}
{
"itemList": [
{
"id": 70110,
"myClass": {
"id": 3,
"name": "itemName",
"date": "2000-01-01"
},
},
{
"id": 70111,
"myClass": {
"id": 3,
"name": "itemName",
"date": "2000-01-01"
},
}
]
}