CCEE persistence supports multi-tenant tables.
Code:
Example:
Table "Article"
Fiels:
TENANT (key)
ARTICLEID (key)
TEXT
WEIGHT
...
So the system is used by several compaies/tenants - and the data of each company/tenant is separated from the other's by the TENANT field in each table.
In the corresponding entity object you define:
Code:
@doentity(name="ARTICLE",tenantColumn="TENANT")
public class DOAritcle
{
@doproperty(key=true,name="ARTICLEID")
public String getArticleId() ...
...
}
For the application the TENANT-columns is invisible. The application lives in a tenant context - and all SQL statements to the DB are automatically updated so taht the tenant column is filled correctly.
Now...: how to define the tenant context?
The central interface here is "ITenantAccess" which is used by the CCEE-functions (and in general by CC-functions).
When using "DefaultTenantAccess", then the tenant context is created in two ways:
Code:
a. DefaultTenantAccess.associateTenantWithCurrentSession("TENANT4711");
b. DefaultTenatnAccess.associateTenantWithCurrentThread("TENANT4711");
a. is used for threads that are processed within a http-request processing. Here the tenant is stored in the session context.
b. is used in threads that are independent from http-request processing. Here the tenant is stored in a Thread-Map.
If you do not explicitly create a tenant context (e.g. when testing), then tenant "undefined" is used. And then you get the message that you showed. - Working with tenant "undefined" should be an option that you really use for text purpose only...!
Regards, Björn