I am trying to break my application into modules using functions packaged in separate banks, such as feature-a.jar, feature-b.jar, etc.
Separate function banners, such as feature-a.jar, should contain all the code for the function, including jpa objects, business logic, the rest of apis, unit tests, integration test ... etc.
The problem I am facing is that bidirectional relationships between JPA objects cause circular references between jar files. For example, the Customer object should be in customer.jar, and the Order should be in order. Jar, but the Client refers to the order and the order, referring to the client, making it difficult to separate it into separate jars / eclipse projects.
The options that I see for working with circular dependencies in a JPA entity:
- Option 1: Put all the objects in one container / one project
- Option 2: Do not map specific bi-directianl relationships to avoid circular dependencies between projects.
Questions:
- What rules / principles did you use to decide when to do bi-directional matching versus no?
- You were able to break jpa objects into your own projects / jar by function, if so, how did you avoid circular dependency problems?
source share