configure the schema name dynamically based on user input.
We have two schemas:
Schema1 - base schema having 15 tables.
Schema2 - tables which is specific to modules. Having only 10 tables which is also available in Schema1
Login to application using Schema 1
Access a particlular module and select the country. Here country selection is identified.
Based on the country selection, we need to connect the schema respectively.
If the user selects France --> It should connect Schema1
If the user selects Germeny --> It should connect schema2.
You may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
You may also want to investigate EclipseLink multi-tenant support,
You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier.