Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360731

Summary: [Multi-Tenancy] Invalid validation against default tenant discriminator column on subentity with JOINED strategy
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JPAAssignee: Karen Butzke <karenfbutzke>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: karenfbutzke
Version: unspecified   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard: EclipseLink

Description Nan Li CLA 2011-10-12 16:59:49 EDT
Build Identifier: M20110909-1335

With JOINED inheritance strategy, if just applying Multitenant annotation to the subentity, an error message complaining the default tenant discriminator column <"the tenant discriminator column defined on the super entity"> cannot be resolved on the table of the subentity will be given. It seems to try to pull the tenant discriminator column from the super entity, which is incorrect. We should not give error with this case. The use case likes

@Entity
@Multitenant(MultitenantType.SINGLE_TABLE)
@TenantDiscriminatorColumn(name="FOO_ID")
@Inheritance(strategy = JOINED)
@DiscriminatorColumn(name = "GENDER")
public class Foo extends SuperFoo implements Serializable {
    ... ...
}

@Entity
@Multitenant(MultitenantType.SINGLE_TABLE) // error is given here
@Table(name = "FOO2")
@PrimaryKeyJoinColumn(name = "FOO2_ID", referencedColumnName = "FOO_ID")
public class SubFoo extends Foo implements Serializable {
    ... ...
}

Reproducible: Always
Comment 1 Nan Li CLA 2011-10-13 10:18:55 EDT
The error message is given without even applying Multitenant annotation to the subentity.
Comment 2 Nan Li CLA 2011-10-13 11:20:52 EDT
If specifying table attribute for the tenant discriminator column(s) defined in the super entity, the error message will be gone.
Comment 3 Karen Butzke CLA 2011-10-13 13:25:16 EDT
I fixed this by not validating the default tenant discriminator columns in this case. They will be validated on the root entity, where any problems can be fixed.