Community
Participate
Working Groups
Build Identifier: An unwanted insert statement generated when using ElementCollection with lazy loading and weaving enabled. Reproducible: Always Steps to Reproduce: 1. Unzip enclosed testcase source and compile it. 2. Change persistence.xml to point to the database. 3. Execute test.CreateDatabase class to create all necessary tables. 4. Execute sql/testdata.sql to create test data for reproducing this issue. 5. Execute test.Test class passing -javaagent:eclipselink.jar to enable weaving to notice an extra row which does not get deleted from table SR_EC_SHIPMENT_CARGNAT.
Created attachment 193325 [details] Testcase Source
The issue is the databaseCount of the DirectCollectionChangeRecord is incremented prior to recording the removal from the collection. The code however assumes that the element has already been removed from the collection as it would have been for DeferredChangeTracking. Working on probable fix currently.
Created attachment 193952 [details] Proposed Fix inclusing testcase.
Fixed in EL trunk At revision: 9259
Added a flag to CollectionChangeEvent to identify if the change has already been applied to the collection before raising collection change event ADD or REMOVE. The flag will be passed as true from IndirectList, IndirectSet and IndirectMap whereas false from DirectCollectionMapping while merging the object. Changed ContainerPolicy and its subclasses to pass the flag in createChangeEvent method.
Reopening the bug as the testcase added for this bug does not work when run along with Application Servers (WLS/WAS/JBoss/GlassFish).
Created attachment 194080 [details] Fix for testcase to run along with App Servers
Fixed test case to run with application servers. At Revision: r9261
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink