Bug 486015 - Bug while using Multitenancy with PK=true and Inheritance
Summary: Bug while using Multitenancy with PK=true and Inheritance
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-18 03:09 EST by Martin Freidank CLA
Modified: 2022-06-09 10:06 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Freidank CLA 2016-01-18 03:09:29 EST
During processing of metadata there occurs a NullPointerException if you decide to use multitenancy with inherited entity structure.

You can easily reproduce this with the following entities:

@Entity
@Multitenant
@TenantDiscriminatorColumn(primaryKey = true)
public class Base
{
	@Id
	private Long id;
}


public class Derived extends Base
{
}


The fix is simple using the following patch. All Tests run successfully.


Index: InheritanceMetadata.java
===================================================================
--- InheritanceMetadata.java	(revision 0)
+++ InheritanceMetadata.java	(working copy)
@@ -235,7 +235,7 @@
             
             // If the root descriptor has an id class, we need to set the same 
             // id class on our descriptor.
-            if (rootDescriptor.hasCompositePrimaryKey()) {
+            if (rootDescriptor.hasPKClass()) {
                 descriptor.setPKClass(rootDescriptor.getPKClass());
             }
         } else {
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:06:24 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink