public void testMapDeletion() {
OpenJPAEntityManager pm;
pm = getPM();
startTx(pm);
SCOTest test = new SCOTest();
pm.persist(test);
Map map = new HashMap();
map.put("foo", new Integer(1));
map.put("bar", new Integer(2));
for (int i = 0; i < 10; i++)
map.put("baz#" + i, new Integer(i));
test.setStrIntMap(map);
Object id = pm.getObjectId(test);
endTx(pm);
startTx(pm);
test = (SCOTest) pm.find(SCOTest.class, id);
assertNotNull(test);
map = test.getStrIntMap();
assertEquals(12, map.size());
assertEquals(new Integer(1), map.get("foo"));
assertEquals(new Integer(2), map.get("bar"));
map.remove("bar");
endTx(pm);
startTx(pm);
test = (SCOTest) pm.find(SCOTest.class, id);
assertNotNull(test);
map = test.getStrIntMap();
assertEquals(11, map.size());
assertEquals(new Integer(1), map.get("foo"));
assertTrue(map.get("bar") == null);
map.clear();
endTx(pm);
startTx(pm);
test = (SCOTest) pm.find(SCOTest.class, id);
assertNotNull(test);
map = test.getStrIntMap();
assertEquals(0, map.size());
endTx(pm);
}