I use JPA persistence for my data models with Eclipselink as the persistence provider. I have a modular (OSGi) application and one of the modules contains the standard data model and a persistence unit that automatically includes all the entities from the package. The persistence provider is in another module, which works well.
Now I want a third module to add some entities to the persistence unit. How do I do that? I found this solution, which seems specific to Spring which I'm not using. The summary of that approach is to write a post processor that hooks into the persistence unit processing and manually merges <class>
entries from the persistence.xml
files.
Is it possible to merge persistence units? Can anybody suggest a workaround?