Bug 354013 - [EclipseLink] Single-Table Multi-Tenancy model support
Summary: [EclipseLink] Single-Table Multi-Tenancy model support
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard: EclipseLink
Keywords: plan
Depends on:
Blocks:
 
Reported: 2011-08-05 10:45 EDT by Karen Butzke CLA
Modified: 2011-10-11 17:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Karen Butzke CLA 2011-08-18 12:51:33 EDT
new includeCriteria setting on Multitenant annotation: bug 355093
Comment 2 Karen Butzke CLA 2011-08-26 15:19:52 EDT
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.
Comment 3 Karen Butzke CLA 2011-09-14 16:10:18 EDT
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"
Comment 4 Karen Butzke CLA 2011-10-04 08:51:59 EDT
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.