[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: merge does not copy basic mappings

Hi Gordon !

I wrote a testcase. This testcase was successfull under 1.0.1 but not successfull under 1.1.

@Test
public void testMerge() {

	deleteFromTables("M_HIST_B");

	HistB b = new HistB();
	b.setValidFrom(new Date());
	b.setVersion(1);
	b.setName("B");

	HistB managedB = (HistB)em.merge(b);

	b = new HistB();
	b.setId(managedB.getId());
	b.setValidFrom(managedB.getValidFrom());
	b.setVersion(managedB.getVersion());
	b.setName("CHANGED");

	HistB managedB2 = (HistB)em.merge(b);

	Assert.assertEquals("CHANGED", managedB2.getName());
}

HistB is a JPA Entity with a compound key (id, validFrom, version). The id is generated by a sequence.

I think there is be a problem when the merge find an entity in the cache. In this case the primitive attributes are not copied in the merged entity.