4.7 Entity DataSource mapping
To provide flexibility for storing entities across different databases (and also to support SAAS providers) each
entity has its own datasource configuration. This configuration is stored in a relational database.
The database data where this configuration is stored should be passed as properties for the coordinator node at application startup, e.g.:
-DtenantConfig.username=userName
-DtenantConfig.password=password
-DtenantConfig.datasourceUrl=jdbc:mysql://xxx.xxx.x.xx:3306/tenantconfig
The table name must be TENANT_ENTITY_CONFIG, it should have two columns, propertyName and propertyValue.

Multi-tenancy applications
The propertyName should follow the following format:
storer.TenantId.entityName.property
For example:

Here T1 is the id of the tenant and the multiTenant attribute signals if the entity datasource data points to a datasource where several tenant's
data is stored together or ( if false) the datasource data points to the tenant private database.
Non multi-tenancy applications
The propertyName should follow the following format:
storer.ApplicationName.entityName.property
For example:

In this example there is the application name is Warehousing - in essence there is one tenant and it's name is the application name.
Note the application 'name' must match the one modelled in the .osm file.
As part of the generation phase a SQL file 'singleTenant.sql' is generated in the main project directory. This SQL file is based on the modelled DataSources.
It can be used as a basis for the configuration.
|