Let's say that I have 2 microservices: Service1 and Service2. Each one of them has its own database. Service1 has EntityA and Service2 has EntityB
EntityA {
Long id;
//other fields
EntityB entity;
}
EntityB{
//other fields
}
I'm using Spring's RestTemplate for retrieving and saving data. The problem is : when retrieving EntityA from Service1's database I don't have data of EntityB as they are held in Service2's db, I understand that I should make a rest call via RestTemplate to retrieve EntityB from Service2's db, but what about relationship between the entities - should EntityA still have the whole EntityB object inside even though its fields are null most of the time except id ? What am I missing? Thank you in advance.