Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364922

Summary: mapkey column created but not populated and queries fail with a QueryException
Product: z_Archived Reporter: Phillip Ross <phillip.w.g.ross>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P2 CC: kishor.gandham, nagyga1, niveditapdixit, phillip.w.g.ross, sheba.public+eclipsebugs, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
testcase zip file
none
test output none

Description Phillip Ross CLA 2011-11-27 17:31:57 EST
Build Identifier: 

An entity with uni-directional OneToMany property and @MapKeyColumn annotation has the correct database tables created, with the mapping table containing a "key column, but persisting an entity only populates the id columns and not the key column.   The persist operation does not throw an error, but subsequent queries soon fail with the following error:
Exception Description: The field [ORGANIZATION.MAILINGADDRESSES_KEY] in this expression has an invalid table in this context.

This problem occurs when using glassfish-v3.1.1/eclipselink-2.3.0/postgresql/jta as well as a standalone eclipselink-2.3.0 or 2.3.1 using derby and local transactions.  A test case will be attached illustrating successful entity persistence, followed by querying the tables showing the nulled key column, and then jpa queries failing.

Reproducible: Always

Steps to Reproduce:
1. Uncompress attached testcase zip file.
2. Download derby, persistence, and eclipselink jars and put them in src/libs directory.
3. Run ant script in the base directory with the targets "ant clean test" (without the quotes)
Comment 1 Phillip Ross CLA 2011-11-27 17:35:03 EST
Created attachment 207586 [details]
testcase zip file
Comment 2 Phillip Ross CLA 2011-11-27 17:35:30 EST
Created attachment 207587 [details]
test output
Comment 3 Phillip Ross CLA 2011-11-27 17:37:37 EST
This is possibly the same or similar to bug 344893
Comment 4 Tom Ware CLA 2011-12-14 15:37:51 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 5 Sebastian Bartholomäus CLA 2013-09-11 04:44:17 EDT
This is still present in 2.5.0 using glassfish 4, JavaSE and Derby DB.
Comment 6 Kishor Gandham CLA 2014-03-06 12:24:39 EST
Please fix. This is impacting OneToMany Map<String,Object> relationships
Comment 7 Gabor Nagy CLA 2015-06-23 03:28:28 EDT
Still there in 4.1 Build 13 with EclipseLink 2.5.2, PostgreSQL. Standalone EclipseLink works properly.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:08:08 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:16:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink