Community
Participate
Working Groups
@Entity @Table(name="TLG_CONTACT") public class Contact implements Serializable, PortableObject { @Id protected String info; ... @Embedded protected InternalItemsHolder internalItemsHolder; ... } @Embeddable public class InternalItemsHolder implements Serializable, PortableObject{ ... @ElementCollection() @CollectionTable(name= "TLG_INTERN_HOLDER_ACTION_ITEMS") @MapKeyColumn(name="KEY") protected Map<Integer, ActionItem> actionItems;*/ ... } @Embeddable public class ActionItem implements Serializable, PortableObject{ protected String description; ...} causes NPE during persistence unit deployment (descriptor initialization). Note that even after this bug is fixed usage of AggregateCollectionMappings Maps on Embedded would still be impossible due to bug 391060.
Created attachment 221864 [details] Suggested patch MappedKeyContainer policy holds a back reference to the mapping - valueMapping. The problem is that this attribute is not reset after the mapping is cloned: the cloned container policy still holds reference to the original mapping. To fix this CollectionPolicy should use setContainerPolicy method in clone (not just assign the cloned container policy) and setContainerPolicy should be overridden by all implementor of MapComponentMapping interface to set correct valueMapping.
see also: 391060
Created attachment 263710 [details] Testcase Can anyone confirm that this is the same bug? I attached a testcase that fails with a NPE with a ManyToMany mapping of a map in an embeddable.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink