Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328774 - TABLE_PER_CLASS-mapped key of a java.util.Map does not work for querying
Summary: TABLE_PER_CLASS-mapped key of a java.util.Map does not work for querying
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: table_per_class submitted_patch
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-26 16:28 EDT by Frank Schwarz CLA
Modified: 2022-06-09 10:35 EDT (History)
3 users (show)

See Also:


Attachments
full stacktrace (6.05 KB, text/plain)
2010-10-26 16:30 EDT, Frank Schwarz CLA
no flags Details
reproducer (5.66 KB, application/zip)
2010-10-26 16:33 EDT, Frank Schwarz CLA
no flags Details
proposed patch (1.42 KB, patch)
2010-10-26 16:36 EDT, Frank Schwarz CLA
peter.krogh: iplog+
Details | Diff
Final patch (includes model and testing with core fix) (15.66 KB, patch)
2010-11-24 09:40 EST, Guy Pelletier CLA
no flags Details | Diff
Final patch (includes model and testing with core fix) (16.55 KB, patch)
2010-11-24 09:52 EST, Guy Pelletier CLA
guy.pelletier: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Schwarz CLA 2010-10-26 16:28:42 EDT
Build Identifier: Trunk

@Entity
public class DesignPattern {
  @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
  private Map<ProgrammingLanguage, CodeExample> codeExamples = new HashMap<ProgrammingLanguage, CodeExample>();
}


@Entity
public class CodeExample extends BaseEntity { }


@Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class BaseEntity { }



A simple query "SELECT x FROM DesignPattern x" causes:

[EL Warning]: Exception [EclipseLink-6157] (Eclipse Persistence Services - @VERSION@.@QUALIFIER@): org.eclipse.persistence.exceptions.QueryException
Exception Description: Element [user.test.model.CodeExample@879860] is being added to a map without a key.  This generally means the database does not hold a key that is expected.
Query: ReadAllQuery(name="codeExamples" referenceClass=CodeExample sql="SELECT t1.ID, t1.CONTENT, t0.codeExamples_KEY FROM DESIGNPATTERN_CODEEXAMPLE t0, CODEEXAMPLE t1 WHERE ((t0.DesignPattern_ID = ?) AND (t1.ID = t0.codeExamples_ID))")


Reproducible: Always
Comment 1 Frank Schwarz CLA 2010-10-26 16:30:58 EDT
Created attachment 181776 [details]
full stacktrace
Comment 2 Frank Schwarz CLA 2010-10-26 16:33:41 EDT
Created attachment 181777 [details]
reproducer
Comment 3 Frank Schwarz CLA 2010-10-26 16:36:55 EDT
Created attachment 181778 [details]
proposed patch
Comment 4 Tom Ware CLA 2010-11-12 08:20:42 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 5 Guy Pelletier CLA 2010-11-24 09:40:11 EST
Created attachment 183762 [details]
Final patch (includes model and testing with core fix)
Comment 6 Guy Pelletier CLA 2010-11-24 09:52:33 EST
Created attachment 183768 [details]
Final patch (includes model and testing with core fix)
Comment 7 Guy Pelletier CLA 2010-11-24 09:56:51 EST
Patch submitted.

Reviewed by: Guy Pelletier, Tom Ware
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:15:49 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:35:24 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink