Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360731 - [Multi-Tenancy] Invalid validation against default tenant discriminator column on subentity with JOINED strategy
Summary: [Multi-Tenancy] Invalid validation against default tenant discriminator colum...
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard: EclipseLink
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 16:59 EDT by Nan Li CLA
Modified: 2011-10-13 13:25 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.
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.