Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MergeChangeSetCommand NullPointerException" in remote EclipseLink Session
MergeChangeSetCommand NullPointerException" in remote EclipseLink Session [message #478727] Thu, 06 August 2009 14:53 Go to next message
Amod M is currently offline Amod M
Messages: 11
Registered: July 2009
Junior Member
I am using EclipseLink 1.0.2.
I have Parent & Child with 1:m relationship. When I delete a child object
which is held in Parent's child collection (ValuHolder)I am getting
"command type MergeChangeSetCommand Internal Exception:
java.lang.NullPointerException" in remote EclipseLink session. I didn't
get this kind of error in toplink.

Parent has 1: m with Child.
OneToManyMapping childsMapping = new OneToManyMapping();
childsMapping.setAttributeName("childs");
childsMapping.setReferenceClass(Child.class);
childsMapping.setRelationshipPartnerAttributeName("parent");
childsMapping.privateOwnedRelationship();
childsMapping.useBasicIndirection();

Child has back reference to Parent.
DirectToFieldMapping parentIdMapping = new DirectToFieldMapping();
parentIdMapping.setAttributeName("parentId");
parentIdMapping.setFieldName("t_Child.parent_id");
descriptor.addMapping(parentIdMapping);

OneToOneMapping parentMapping = new OneToOneMapping();
parentMapping.setAttributeName("parent");
parentMapping.setReferenceClass(Parent.class);
parentMapping.setRelationshipPartnerAttributeName("childs");
parentMapping.useBasicIndirection();
parentMapping.addForeignKeyFieldName("t_Child.parent_id", "t_Parent.id");

I am using ValueHolder for holding relationship object.

When I remove child from Parent's child collection, everything works fine
in local session. But following exception occures in remote EclipseLink
session. In remote session, When Eclipselink tries to remove child object,
it doesn't get entry of child object in its identityMap. Hence while
removing child object,following excpetion comes.

command type MergeChangeSetCommand
Internal Exception: java.lang.NullPointerException
at

org.eclipse.persistence.exceptions.RemoteCommandManagerExcep tion.errorProcessingRemoteCommand(RemoteCommandManagerExcept ion.j

ava:208)
at

org.eclipse.persistence.internal.sessions.coordination.broad cast.BroadcastRemoteConnection.processReceivedObject(Broadca stRem

oteConnection.java:184)
at

org.eclipse.persistence.internal.sessions.coordination.jms.J MSTopicRemoteConnection.onMessage(JMSTopicRemoteConnection.j ava:1

79)
at

org.eclipse.persistence.internal.sessions.coordination.jms.J MSTopicRemoteConnection$JMSOnMessageHelper.run(JMSTopicRemot eConn

ection.java:348)

at
org.eclipse.persistence.internal.queries.MapContainerPolicy. keyFrom(MapContainerPolicy.java:277)
at
org.eclipse.persistence.internal.queries.MapContainerPolicy. removeFrom(MapContainerPolicy.java:339)
at
org.eclipse.persistence.internal.queries.ContainerPolicy.mer geChanges(ContainerPolicy.java:653)
at
org.eclipse.persistence.mappings.CollectionMapping.mergeChan gesIntoObject(CollectionMapping.java:756)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.m ergeChangesIntoObject(ObjectBuilder.java:2476)
at
org.eclipse.persistence.internal.sessions.MergeManager.merge ChangesIntoDistributedCache(MergeManager.java:417)
at
org.eclipse.persistence.internal.sessions.MergeManager.merge Changes(MergeManager.java:247)
at
org.eclipse.persistence.internal.sessions.MergeManager.merge ChangesFromChangeSet(MergeManager.java:344)

Can anyone please give suggestions?

Thanks for any help.
Re: MergeChangeSetCommand NullPointerException" in remote EclipseLink Session [message #480792 is a reply to message #478727] Tue, 18 August 2009 13:55 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I would recommend logging a bug. You may also try to see if the issue
still occurs in 1.1 or 2.0. The bug seems to be related to using a Map
container policy, but your mapping did not seem to include this?

As a workaround, you may consider switching cache coordination to use
invalidation instead of change sets.

http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/per sistence/descriptors/ClassDescriptor.html#setCacheSynchroniz ationType(int)

---
James


James : Wiki : Book : Blog : Twitter
Re: MergeChangeSetCommand NullPointerException" in remote EclipseLink Session [message #481027 is a reply to message #480792] Wed, 19 August 2009 11:22 Go to previous messageGo to next message
Amod M is currently offline Amod M
Messages: 11
Registered: July 2009
Junior Member
Hi James,

Thanks a lot for your reply.

I didn't include full mapping for 1:m relationshoip. Parent descriptor
uses Map container policy for containing child collection.
Is it a bug related to Map container policy?

Here are the mappings.

Parent Descriptor

DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("t_Parent.id");
descriptor.addMapping(idMapping);

OneToManyMapping childsMapping = new OneToManyMapping();
childsMapping.setAttributeName("childs");
childsMapping.setReferenceClass(Child.class);
childsMapping.setRelationshipPartnerAttributeName("parent");
childsMapping.privateOwnedRelationship();
childsMapping.useBasicIndirection();
childsMapping.useMapClass(java.util.HashMap.class, "getAnotherid");
childsMapping.addTargetForeignKeyFieldName("t_Child.parent_id ",
"t_Parent.id");
descriptor.addMapping(childsMapping);


Child Descriptor

DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("t_Child.id");
descriptor.addMapping(idMapping);

DirectToFieldMapping anotheridMapping = new DirectToFieldMapping();
anotheridMapping.setAttributeName("anotherid");
anotheridMapping.setFieldName("t_Child.anotherid");
descriptor.addMapping(anotheridMapping);

DirectToFieldMapping parentIdMapping = new DirectToFieldMapping();
parentIdMapping.setAttributeName("parentId");
parentIdMapping.setFieldName("t_Child.parent_id");
parentIdMapping.readOnly();
descriptor.addMapping(parentIdMapping);

OneToOneMapping parentMapping = new OneToOneMapping();
parentMapping.setAttributeName("parent");
parentMapping.setReferenceClass(Parent.class);
parentMapping.setRelationshipPartnerAttributeName("childs");
parentMapping.useBasicIndirection();
parentMapping.addForeignKeyFieldName("t_Child.parent_id", "t_Parent.id");
descriptor.addMapping(parentMapping);

Thanks a lot for any help.

Regards
Re: MergeChangeSetCommand NullPointerException" in remote EclipseLink Session [message #481060 is a reply to message #481027] Wed, 19 August 2009 13:01 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Yes, the issue is related to the MapContainerPolicy. There seems to be an
issue with the distributed merge code when something is removed and it is
not in the target server's cache.

Please log the bug, as a workaround either remove the Map, or use
invalidation for the cache coordination.


James : Wiki : Book : Blog : Twitter
Previous Topic:Source Attach for EclipseLink
Next Topic:JPA DAO in Desktop Application
Goto Forum:
  


Current Time: Fri Sep 19 15:59:43 GMT 2014

Powered by FUDForum. Page generated in 0.01703 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software