Specify multiple discriminator columns for single-table multitenancy by using the @TenantDiscriminatorColumns annotation to contain multiple @TenantDiscriminatorColumn annotations.
Table 2-68 describes this annotation's elements.
Table 2-68 @TenantDiscriminatorColumns Annotation Elements
| Annotation Element | Description | Default |
|---|---|---|
|
|
(Optional) One or more |
none |
You must use the @TenantDiscriminatorColumns annotation to contain multiple @TenantDiscriminatorColumn annotations. The @TenantDiscriminatorColumns annotation cannot be used alone, and multiple the @TenantDiscriminatorColumn annotations cannot be used alone, without @TenantDiscriminatorColumns.
@Entity
@Table(name = "EMPLOYEE")
@Multitenant(SINGLE_TABLE)
@TenantDiscriminatorColumns({
@TenantDiscriminatorColumn(name = "TENANT_ID", contextProperty = “tenant-id)
@TenantDiscriminatorColumn(name = "TENANT_CODE", contextProperty = “tenant-code)})
See "@TenantDiscriminatorColumn" for more examples of @TenantDiscriminatorColumns.