Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Map-related Exception in M5

Tom,

yes, this is a container-managed transaction committing, Glassfish against MySQL.

Here's a snippet from the SLSB managing the entities:

-----

WidgetData data;
if(id > 0) {
	data = em.find(WidgetData.class, id);
} else {
	data = new WidgetData();
	data.setApplicationInstance(applicationInstance);
	if(partKey != null && partKey.length() > 0) {
		applicationInstance.getParts().put(partKey, data);
		data.setPartKey(partKey);				
	}
			
	// flush to update the ID
	em.flush();
}
		
data.setModificationTime(new Date());
data.setTitle(title);
data.setContent(content);
		
return data;

----

id is -1 in the test case in question, partKey is a String != null.
So there's a new WidgetData entity being added.

Snippet from the "WidgetApplicationInstance" entity:

----

@Id
@SequenceGenerator(name="WIDGETAPPLICATIONINSTANCE_SEQUENCE_GENERATOR")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="WIDGETAPPLICATIONINSTANCE_SEQUENCE_GENERATOR")
private long ID;
	
private int instanceNumber;
	
@ManyToOne
private WidgetApplication application;
	
@ManyToOne
private User owner;

@OneToMany(mappedBy="applicationInstance", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@MapKey(name="partKey")
private Map<String, WidgetData> parts = new HashMap<String, WidgetData>();

@javax.persistence.Version
protected int optimisticLockVersion;


----


Thanks for looking into this,

rv




Am 20.03.2008 um 22:59 schrieb Tom Ware:

Hi,

Can you give us an idea of what you are doing? It looks like a transaction is committing. What Entities are involved in the transaction? How are they mapped? What change are you making?

Thanks,
Tom

wintermute@xxxxxxxxxxxxxxxxxx wrote:
Hi list,
I just deployed my application with EclipseLink M5, without any trouble this time. For the most part, things look pretty good. One of my entities, however, doesn't like to have it's map changed. The code works in TL Essentials. Has this been reported? Can I do anything to avoid the issue? (Stack trace attached.)
Thanks,
rv
[#|2008-03-20T13:24:15.390+0100|WARNING|sun-appserver9.1| org.eclipse.persistence.session.file:/usr/local/server/glassfish/ domains/domain1/applications/j2ee-apps/com.bookpac.server/pu.jar- ormpersistence.transaction|_ThreadID=48;_ThreadName=TestThread- c257e1ca1761a0f247942e3fddad;_RequestID=93b4959c-21f5-4938- a42b-0b53fa7f10bc;| java.lang.NullPointerException at org.eclipse.persistence.internal.queries.MapContainerPolicy.compareKe ys(MapContainerPolicy.java:147) at org.eclipse.persistence.internal.queries.ContainerPolicy.compareColle ctionsForChange(ContainerPolicy.java:259) at org.eclipse.persistence.mappings.CollectionMapping.compareCollections ForChange(CollectionMapping.java:323) at org.eclipse.persistence.mappings.CollectionMapping.compareForChange (CollectionMapping.java:363) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDete ctionPolicy.createObjectChangeSetThroughComparison (DeferredChangeDetectionPolicy.java:135) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDete ctionPolicy.createObjectChangeSet (DeferredChangeDetectionPolicy.java:114) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDete ctionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java: 80) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateCha nges(UnitOfWorkImpl.java:523) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToData baseWithChangeSet(UnitOfWorkImpl.java:1320) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.issueSQLbefo reCompletion(UnitOfWorkImpl.java:2862) at org.eclipse.persistence.internal.jpa.RepeatableWriteUnitOfWork.issueS QLbeforeCompletion(RepeatableWriteUnitOfWork.java:209) at org.eclipse.persistence.transaction.AbstractSynchronizationListener.b eforeCompletion(AbstractSynchronizationListener.java:157) at org.eclipse.persistence.transaction.JTASynchronizationListener.before Completion(JTASynchronizationListener.java:68) at com.sun.enterprise.distributedtx.J2EETransaction.commit (J2EETransaction.java:419) at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit (J2EETransactionManagerOpt.java:371) at com.sun.ejb.containers.BaseContainer.completeNewTx (BaseContainer.java:3792) at com.sun.ejb.containers.BaseContainer.postInvokeTx (BaseContainer.java:3571) at com.sun.ejb.containers.BaseContainer.postInvoke (BaseContainer.java:1354) at com.sun.ejb.containers.BaseContainer.postInvoke (BaseContainer.java:1316) at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke (EJBObjectInvocationHandler.java:210) at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke (EJBObjectInvocationHandlerDelegate.java:77) at $Proxy306.setPerInstanceUserData(Unknown Source)
[...]
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top