Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » "Bug" with JPA InheritanceType SINGLE_TABLE and key
"Bug" with JPA InheritanceType SINGLE_TABLE and key [message #1816357] Mon, 28 October 2019 11:13 Go to next message
Bruno DARMET is currently offline Bruno DARMETFriend
Messages: 1
Registered: October 2019
Junior Member
Hello, I think I've found a bug in the 2.7.5 eclipselink version : I have one table with a composite primary key (ADDRESS_TYPE, and ADDRESS_KEY). I create classes with a DiscriminatorColumn (PrivateAddress, ProfessionalAddress, etc...). When I do a query (findAll) in my PrivateAddress class, the query return a list of ProfessionalAddress because the rows {{PRIVATE, 1} and {PROFESSIONAL, 1}} both exist. This bug occurs (for me) because the org.eclipse.persistence.internal.descriptors.ObjectBuilder loads primaryKeyFields from this.descriptor.getPrimaryKeyFields() (line 3095) without taking the DiscriminatorColumn, so for this table, with only ADDRESS_KEY as primary key, jpa found the wrong object.

I can send you my code if needed.

Thank's for your help, and please forgive my english : I'm french. ;-)....
Re: "Bug" with JPA InheritanceType SINGLE_TABLE and key [message #1816395 is a reply to message #1816357] Tue, 29 October 2019 01:47 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
You would have to show how you've mapped your primary key, but it seems like you might have only specified the ADDRESS_KEY as the ID for the hierarchy.

Having the Type be part of a composite primary key is not usual - all your foreign keys to that table are going to have to specify both the key and the type; something that could be avoided if you had a unique column in the table for the ID.

[Updated on: Tue, 29 October 2019 01:48]

Report message to a moderator

Previous Topic:eclipselink 2.7.4 and java 13 causes java.lang.IllegalArgumentException
Next Topic:Size of @OneToMany List
Goto Forum:

Current Time: Thu May 30 11:13:19 GMT 2024

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

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

Back to the top