0

There is an employee entity, it can have multiple address entities. I have added @ManyToOne of employee class to the address object

In most get calls i want to return only the employee object. But at times i want to return an employee object with an address list. How do I achieve this?

Something similar to what is happening in the below question. I just want to make it work on a toggle Spring: When getting a ManyToOne entity, reference entity (OneToMany) is not showing in JSON

RA26
  • 111
  • 1
  • 7
  • You basically want to look at "lazy loading", for example here - https://stackoverflow.com/a/21648448/384674 – Betlista Feb 01 '18 at 13:01
  • Was this really a duplicate of that question? Same "dupe" was linked in question itself as a reference _Something similar to what is happening in the below question_ and IMO question is about howto control whether to return addresses or not? Well, maybe @RA26 could ask a new better formulated question with code for the classes if needed. – pirho Feb 01 '18 at 15:17

0 Answers0