public void dynamic_insertAndLoad() throws Exception {
PersistenceSession session = persistenceManager.createSession();
try {
DynamicCompEntity inst = new DynamicCompEntity();
inst.setId(11);
DynamicComposite dyn = new DynamicComposite();
dyn.addBool(true);
dyn.addUtf8String("Ursus");
dyn.addInt(42);
inst.setDyn(dyn);
session.insert(inst);
DynamicCompEntity loaded = session.loadOne(DynamicCompEntity.class, 11);
Assert.assertNotNull(loaded);
dyn = loaded.getDyn();
Assert.assertNotNull(dyn);
Assert.assertEquals(dyn.size(), 3);
Assert.assertEquals(dyn.getType(0), DataType.cboolean());
Assert.assertEquals(dyn.getType(1), DataType.text());
Assert.assertEquals(dyn.getType(2), DataType.cint());
Assert.assertEquals(dyn.getBool(0), true);
Assert.assertEquals(dyn.getString(1), "Ursus");
Assert.assertEquals(dyn.getInt(2), 42);
} finally {session.close();}
}