vivek murali
vivek murali

Reputation: 1

JPA Entity Data foregin key

I have data model in microservices A which will be referenced in the microservice B .How to share the model from A to B.

Will it work with sharing the entity as library to microservice B

Upvotes: 0

Views: 37

Answers (1)

Douglas Gardim
Douglas Gardim

Reputation: 420

It's not a good idea to create such coupling between 2 microservices. Either:

  • if it is a natural coupling (implied by the business domain) the 2 microsservices might be better if they were merged together as a single microservice.
  • the "A entity" that is used inside "B microservice" is actually representing another role/concept based on the same real world domain object. As such, it should be represented by another entity, extracting strictly the properties and behaviours that are relevant to this role.

Upvotes: 1

Related Questions