I have an app build with JSF2.x Spring IoC,transactions and JPA over Hibernate. This is a fully functional call center app.
The challenge is that now I want to add some HR functionality where the HR team would perform various tasks. My initial thought was to create this as an module in order to be able to deploy/undeploy independently from the mother app. The communication between main app and HR module will be implemented via REST/SOAP WS or any other async communication technology (JMS).
With this in my mind I already see one problem: database replication. Because the HR module will work with user or user profile objects from my main app. So in this scenario I would send this objects to HR module and probably there I would have a local database where this info will be duplicated and hard to maintain in sync.
The other approach would be to have 2 apps that share the same database, and I guess that this will eliminate the need for a communication layer (WS/JMS...), because the both apps read/write to same database. but as it was expected this also have some drawbacks:
- performing operations from HR module to a user entity will break the cache layer that it is used by the main app;
- sharing the same database will arise some scenarios where for some HR functionality to be forced to alter DB schema, and the to redeploy the main app.
How should I proceed in order to obtain a high level of independence between main app and various modules and without replicate some data for each module?