[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