We are developing a sort of SDK for internal use which includes some custom annotations, request filters and a few JPA entities for storing information about our organization's users. The SDK is a maven artifact and includes the definition of a persistence unit holding the user information entities.
Our problem is this: we must support multiple applications using our SDK being deployed to the same container or in their own containers. (The SDK's persistence components can't be refactored into their own Microservice)
Our question: since the persistent unit our authorization component uses is defined in the SDK, will it cause problems for multiple Java projects running in the same container to reference the same datasource/persistence unit combination? Or is there a way around this that we can and should implement?
One way I can think of is to have a template for the persistence.xml which will have all the configurations except the pu name which needs to a placeholder in the sdk and while building individual application have an ant run script (may be a java class ) from the sdk which will take the project specific pu name from a property file of the app and creates the persistence.xml file of the app by replacing the pu place holder from the template.