Bug 364546 - Enhancement: Updates to a value in an element collection map keyed by entity results in delete/insert instead of an update.
Summary: Enhancement: Updates to a value in an element collection map keyed by entity ...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-23 04:02 EST by Vikram Bhatia CLA
Modified: 2022-06-09 10:09 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vikram Bhatia CLA 2011-11-23 04:02:14 EST
ElementCollection Map of basic values keyed by entity. 

Updating a value of a Map entry seems to be causing EL to remove the
old row in the collection table and insert a new one with the new value instead of updating it in the collection table.

Example of model:

@Entity
public class Department {
    @Id
    private int id;

    @ElementCollection
    @CollectionTable(name="EMP_SENIORITY")
    @MapKeyJoinColumn(name="EMP_ID")
    @Column(name="SENIORITY")
    private Map<Employee, Integer> seniorities;
    ...
}

Code example:

myDept.getSeniorities().put(newEmp, 1);
...
myDept.getSeniorities().put(newEmp, 2);


When modifying the value, the second put() will cause the row in EMP_SENIORITY
table to be removed and a new one to be inserted in the collection table.

Bug 364248 reports two problems. First one has been fixed. However, the other is a performance enhancement.
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:04:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:09:39 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink