@Test
	public void testProtectionEntryMaintenanceOnChangePropertyToSuperclass() throws Exception
	{
		// Change property from one subclass to superclass.
		PersistenceManager pm = new PersistenceManager(driver, database, login, password);
		// drop all tables
		pm.dropTable(Object.class);
		// create two OriginalObjects to give OriginalObject and SubClass
		// different IDs
		pm.saveObject(new OriginalObject());
		pm.saveObject(new OriginalObject());
		// create two SubClass, store them in ContainerObject
		SubClass ns = new SubClass();
		ns.setName("foo");
		ContainerObject co = new ContainerObject();
		co.setFoo(ns);
		pm.saveObject(co);

		ns = new SubClass();
		ns.setName("bar");
		co = new ContainerObject();
		co.setFoo(ns);
		pm.saveObject(co);
		pm.close();

		pm = new PersistenceManager(driver, database, login, password);
		// rename SubClass to a non-existing class, thus removing the subclass
		new TestTools(pm.getPersist()).changeName(SubClass.class, "com.github.conserveorm.NonExistingFakeClass", "FAKE_TABLE",
				"C__ARRAY_FAKE_TABLE");
		// change the database schema
		pm.updateSchema(OriginalObject.class);
		pm.close();

		pm = new PersistenceManager(driver, database, login, password);
		// make sure loading ContainerObject still contains the correct data
		List<ContainerObject> coList = pm.getObjects(ContainerObject.class, new All());
		assertEquals(2, coList.size());
		String zeroFoo = coList.get(0).getFoo().getName();
		String oneFoo = coList.get(1).getFoo().getName();
		assertTrue(zeroFoo.equals("bar") || oneFoo.equals("bar"));
		assertTrue(zeroFoo.equals("foo") || oneFoo.equals("foo"));
		// deleting all OriginalObject or SubClass should now result in no
		// change, as they are protected by ContainerObject
		// assert that there are still four OriginalObject and two SubClass
		// items
		assertEquals(4, pm.getCount(OriginalObject.class, new All()));
		assertEquals(0, pm.getCount(SubClass.class, new All()));
		// delete all OriginalObject/SubClass items
		pm.deleteObjects(OriginalObject.class, new All());
		assertEquals(2, pm.getCount(OriginalObject.class, new All()));
		// check that the contents are preserved
		coList = pm.getObjects(ContainerObject.class, new All());
		assertEquals(2, coList.size());
		assertTrue(zeroFoo.equals("bar") || oneFoo.equals("bar"));
		assertTrue(zeroFoo.equals("foo") || oneFoo.equals("foo"));
		assertEquals(0, pm.getCount(SubClass.class, new All()));
		pm.deleteObjects(SubClass.class);
		assertEquals(2, pm.getCount(OriginalObject.class, new All()));
		assertEquals(0, pm.getCount(SubClass.class, new All()));
		// deleting all ContainerObject should delete all SubClass and
		// OriginalObject, as they have no external reference
		pm.deleteObjects(ContainerObject.class, new All());
		assertEquals(0, pm.getCount(OriginalObject.class, new All()));
		assertEquals(0, pm.getCount(SubClass.class, new All()));

		pm.close();
	}