Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » References to subclass implemented as FK to superclass
References to subclass implemented as FK to superclass [message #645873] Mon, 20 December 2010 21:31 Go to next message
Rich MacDonald is currently offline Rich MacDonaldFriend
Messages: 18
Registered: December 2010
Junior Member
(Apologies for not being able to find a pre-existing bug report. for this, as it is fairly fundamental and should exist. Or perhaps there is a good technical reason for the chosen shortcut. I'm just not good yet at eclipselink search criteria.)

3 Entity classes, A, B and C:

@Inheritance(strategy=InheritanceType.JOINED)
@Entity class A{}

@Entity class B extends A{}

@Entity class C{
public B b;
}

Not showing primary keys etc.

Problem:

eclipselink creates the FK constraint for C.b on table C that points to the PK on table A. This is incorrect. The FK should point to the PK on table B.

Insertion order into the dbase is table A, then table C, then table B. This is legal due to the prior problem, but it is incorrect: Insertion order should be table A, table B, then table C. IOW, "inheritance-first, relationship-second", rather than "relationship-first, inheritance-second".

The result is that if the dbase is existing and has the C.b FK constraint defined correctly, then it is impossible to model this relationship.

Note that this error also occurs if C.b is defined as @ManyToOne, @Id, etc.

Surely this issue is well-known. Any background and links appreciated,
Re: References to subclass implemented as FK to superclass [message #646193 is a reply to message #645873] Wed, 22 December 2010 16:02 Go to previous message
Rich MacDonald is currently offline Rich MacDonaldFriend
Messages: 18
Registered: December 2010
Junior Member
Bug report submitted:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333100
Previous Topic:Eclipse product not saving preferences
Next Topic:ClassNotFoundException on create of TypedQuery
Goto Forum:
  


Current Time: Thu Apr 25 05:50:57 GMT 2024

Powered by FUDForum. Page generated in 0.02779 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top