entityBinding.objectToKey(entity, keyEntry);
Object entity2 = entityBinding.entryToObject(keyEntry, dataEntry);
entity.validate(entity2);
/* Read back the primary key and validate it. */
PersistKeyBinding keyBinding =
new PersistKeyBinding(catalog, keyCls.getName(), false);
Object priKey2 = keyBinding.entryToObject(keyEntry);
assertEquals(priKey, priKey2);
keyBinding.objectToEntry(priKey2, keyEntry2);
assertEquals(keyEntry, keyEntry2);
/* Check raw entity binding. */
PersistEntityBinding rawEntityBinding =
new PersistEntityBinding(catalog, entityCls.getName(), true);
RawObject rawEntity =
(RawObject) rawEntityBinding.entryToObject(keyEntry, dataEntry);
rawEntityBinding.objectToKey(rawEntity, keyEntry2);
rawEntityBinding.objectToData(rawEntity, dataEntry2);
entity2 = entityBinding.entryToObject(keyEntry2, dataEntry2);
entity.validate(entity2);
RawObject rawEntity2 =
(RawObject) rawEntityBinding.entryToObject(keyEntry2, dataEntry2);
assertEquals(rawEntity, rawEntity2);
assertEquals(dataEntry, dataEntry2);
assertEquals(keyEntry, keyEntry2);
/* Check that raw entity can be converted to a regular entity. */
entity2 = catalog.convertRawObject(rawEntity, null);
entity.validate(entity2);
/* Check raw key binding. */
PersistKeyBinding rawKeyBinding =
new PersistKeyBinding(catalog, keyCls.getName(), true);
Object rawKey = rawKeyBinding.entryToObject(keyEntry);
rawKeyBinding.objectToEntry(rawKey, keyEntry2);
priKey2 = keyBinding.entryToObject(keyEntry2);
assertEquals(priKey, priKey2);
assertEquals(keyEntry, keyEntry2);
}