Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Merging an Entity with uninitialized lazy OneToMany mapping removes associated entities

Hi all,

 

today I came across a weird behavior in EclipseLink 2.7.4 which I do not understand:

 

We load an entity from the database that contains a lazy OneToMany mapping to another entity (inside an embeddable) with cascade ALL. This entity is manipulated without touching the indirect collection, so the collection stays uninitialized.

When we then merge this manipulated entity back into an EntityManager, the unitialized indirect collection is set to ‘null’ on the EntityManagers clone of the entity. When we then commit the transaction. The CollectionMapping#compareForChange() method uses getAttributeValueFromObject(clone) which replaces the ‘null’ with an IndirectList containing an empty value holder. This leads to all elements being removed from the mapping which I expected not to happen.

 

Is this a bug in EclipseLink or did we do something wrong? Thanks in advance for any feedback on this.

 

Best Regards

Alexander Lehmann


Back to the top