I have question towards a best practice for configuration of persistence and cache (2nd lvl) within a maven multi module project with spring/jpa/ehcache. Only a single datasource is needed.
Lets assume
I have 3 domain maven modules containing only the entities:
- core_domain
- customers_domain (dependency core_domain)
- products_domain (dependency core_domain)
I also have 3 integration modules containing repositories:
- core_integr
- customers_integr (dependency customers_domain, core_integr)
- products_integr (dependency products_domain, core_integr)
Now these modules MAY eventually be combined into a single WAR.
One approach might be to define all persistence,transaction and caching configuration in the core_integr module. But this does not cleanly allow configuration per module. It's possible, but not clean.
Is it possible to have a persistence.xml and ehcache.xml per integration module? preferably while keeping spring configuration in the core_integr module. OR Do you really need to separate the spring config fully with multiple entitymanagers, persistence_units and cachemanagers all working against the single datasource?
Any advice is welcome.