Jak własciwie działa JsonIdentityInfo?

0

Nałożyłem na klasę adnotację JsonIdentityInfo:

@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Entity
@Table(name = "`COMPANY`")
public class Company {
...

z serwisu zwracam listę obiektów w postaci json, po stronie klienta wygląda tak:

[{
  "id": 948,
  "title": "titlee",
  "company": {
    "id": 926,
    "name": "namee",
    "password": "passwordd"
  },
  "category": "Cat",
  "createdDate": 1528408274691,
  "lastEditDate": 1528408274691,
  "updateVersion": null
}, {
  "id": 949,
  "title": "titlee",
  "company": 926,
  "category": "Cat",
  "createdDate": 1528408284037,
  "lastEditDate": 1528408284037,
  "updateVersion": null
}, {
  "id": 950,
  "title": "titlee",
  "company": 926,
  "category": "Cat",
  "createdDate": 1528408284555,
  "lastEditDate": 1528408284555,
  "updateVersion": null
}, {
  "id": 951,
  "title": "titlee",
  "company": 926,
  "category": "Cat",
  "createdDate": 1528408285035,
  "lastEditDate": 1528408285035,
  "updateVersion": null
}]

Dlaczego w pierwszym obiekcie dostaję cały obiekt COMPANY zamiast tylko elementu property ustawionego w adnotacji JsonIdentityInfo- w tym przypadku id?

0

i pytanie..
Da się we wszystkich elementach wyświetlić tylko property, zamiast obiektu przy uzyciu tej adnotacji?

0

ok poradziłem sobie przenosząc adnotacje w inne miejsce i dodając nową JsonIndentityReference

	@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
	@JsonIdentityReference(alwaysAsId = true)
	@ManyToOne
	@JoinColumn(name="`COMPANY_ID`", nullable = false)
	private Company company;

1 użytkowników online, w tym zalogowanych: 0, gości: 1