Community
Participate
Working Groups
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Single-Table_Multi-Tenancy
new includeCriteria setting on Multitenant annotation: bug 355093
Validation: 1. Multi-tenant metadata can only be applied at the root level of the inheritance hierarchy when using a SINGLE_TABLE or JOINED inheritance strategy. Warning for this case. 2. Tenant discriminator column name exists on the specified table (or primary table if none is specified). Error for this case. 3. If a tenant discriminator column is mapped, then it must be read only. This is done by setting insertable=false and updatable=false. Error on the attribute mapping that maps the tenant discriminator column if it doesn't set insertable=false an updatable=false. Defaults: 1. TenantDiscriminatorColumn name the defaults to TENANT_ID 2. Entity that subclasses a Multitenant MappedSuperclass gets its default TenantDiscriminatorColumn from the MappedSuperclass unless it also specifies Multitenant. 3. TenantDiscriminatorColumn contextProperty defaults to eclipselink.tenant-id 4. persistence-unit-defaults tenant discriminator columns apply to all entities that specify multitenant SINGLE_TABLE and don't specify TenantDiscriminatorColumns. 5. entity-mappings tenant discriminator columns override the persistence-unit-defaults tenant discriminator columns and apply to all entities in the mapping file that specify multitenant SINGLE_TABLE, but no tenant-discriminator-columns.
For M2 I have added support for specified Multitenant and TenantDiscriminatorColumns in java and xml. Java completion proposals for TenantDiscriminatorColumn name and table has been added. Support for virtual columns and columns at the persistence unit and entity mappings level has not yet been added. The following validation has been added: 1. "Multitenant metadata cannot be specified on non-root entities in a SINGLE_TABLE or JOINED inheritance hierarchy". Added this warning if a tenant discriminator column exists, if just the Multitenant annotation or xml element exists then no warning. 2. "Tenant discriminator columns cannot be specified without the Multitenant annotation" - this will only appear if validation 1 does not. 3. "Tenant discriminator column \"{0}\" cannot be resolved on table \"{1}\"" 4. "Table \"{0}\" for tenant discriminator column \"{1}\" not valid for entity"
fixed in M3. everything has been completed except for validation number 3 in comment 2. We will not be doing this validation for the 3.1 release.