Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344893 - OneToMany HashMap MapKeyColumn Created but not Updated in Database
Summary: OneToMany HashMap MapKeyColumn Created but not Updated in Database
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P2 major with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-05 15:50 EDT by Daryl Davis CLA
Modified: 2022-06-09 10:03 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daryl Davis CLA 2011-05-05 15:50:03 EDT
Build Identifier: EclipseLink 2.2.0 (JDK 1.6.24)

An Entity Class has the following property defined
...
    @OneToMany
    @JoinTable(name="DETAILS",
        joinColumns= @JoinColumn(name="DEC_ID"), 
        inverseJoinColumns=@JoinColumn(name="CONN_ID"))
    @MapKeyColumn(name="CHOICEID", length=25)
    Map<String, DetailObject> connections = new HashMap<String, DetailObject>(); 
...
NOTE: Unidirectional mapping... there is not a ManyToOne property defined in DetailObject entity

The TABLE get created correctly, but only the DEC_ID and CONN_ID columns ever get filled with data... I checked did some trouble shooting and the database update only includes the joinColumns ignoring the MapKeyColumn (The HashMaps key) like so:

--- INSERT INTO DETAILS (DEC_ID, CONN_ID) VALUES (?, ?) ---

I reconfigured the project to use OpenJPA, just for a comparative test, and it was updating the value correctly using HashMap property configured as above. 

Reproducible: Always

Steps to Reproduce:
1. Create an EntityA with a @OneToMany HashMap Property with <String, EntityB>
2. Fill the HashMap in EnityA with the <String, EntityB>
3. Persist the EntityA, only the two joinColumns are updated in the database.
Comment 1 Tom Ware CLA 2011-05-20 08:38:38 EDT
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 2 Sebastian Bartholomäus CLA 2013-09-11 04:51:25 EDT
This is still present in 2.5.0 using glassfish 4, JavaSE and Derby DB.
Comment 3 Savvas Andreas Moysidis CLA 2015-05-11 18:38:42 EDT
Adding a note to say that I stumbled across the very same issue by specifying a many-to-many annotation in my case.

I am using the EclipseLink version that comes bundled with the latest version of Glassfish.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:03:30 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink