compositeTableName, CompositeRecord.class, manager);
Dao<SubRecord1> subRecord1Dao = new SpecificAvroDao<SubRecord1>(tablePool, compositeTableName, "SubRecord1", manager);
Dao<SubRecord2> subRecord2Dao = new SpecificAvroDao<SubRecord2>(tablePool, compositeTableName, "SubRecord2", manager);
// Construct records
SubRecord1 subRecord1 = SubRecord1.newBuilder().setKeyPart1("1")
.setKeyPart2("1").setField1("field1_1").setField2("field1_2").build();
SubRecord2 subRecord2 = SubRecord2.newBuilder().setKeyPart1("1")
.setKeyPart2("1").setField1("field2_1").setField2("field2_2").build();
CompositeRecord compositeRecord = CompositeRecord.newBuilder()
.setSubRecord1(subRecord1).setSubRecord2(subRecord2).build();
// Test put
assertTrue(dao.put(compositeRecord));
// validate deleting one of the records doesn't delete the entire row
PartitionKey key = new PartitionKey("1", "1");
subRecord2Dao.delete(key);
subRecord1 = subRecord1Dao.get(key);
assertNotNull(subRecord1);
assertNull(subRecord2Dao.get(key));
// validate the _s columns (like OCCVersion fields) weren't messed with
assertEquals(1L, (long)subRecord1.getVersion());
// validate fetching as composite after a delete of one still works.
compositeRecord = dao.get(key);
assertNotNull(compositeRecord.getSubRecord1());
assertNull(compositeRecord.getSubRecord2());