instBase.setId(1);
instBase.setCid(1);
instBase.setVal("val1");
session.insert(instBase);
TpcInheritA instA = new TpcInheritA();
instA.setId(2);
instA.setCid(1);
instA.setVal("val2");
instA.setInhA("inhA");
session.insert(instA);
TpcInheritB instB = new TpcInheritB();
instB.setId(3);
instB.setCid(1);
instB.setVal("val3");
instB.setInhB("inhB");
session.insert(instB);
TpcInheritB2 instB2 = new TpcInheritB2();
instB2.setId(4);
instB2.setCid(1);
instB2.setVal("val4");
instB2.setInhB("inhB");
instB2.setInhB2("inhB2");
session.insert(instB2);
TpcInheritC instC = new TpcInheritC();
instC.setId(5);
instC.setCid(1);
instC.setVal("val5");
instC.setInhC("inhC");
session.insert(instC);
TpcBaseEntity loadedBase = session.loadOne(TpcBaseEntity.class, 1);
Assert.assertNotNull(loadedBase);
Assert.assertEquals(loadedBase.getId(), 1);
Assert.assertEquals(loadedBase.getVal(), "val1");
TpcBaseEntity loadedA = session.loadOne(TpcInheritA.class, 2);
Assert.assertNotNull(loadedA);
Assert.assertEquals(loadedA.getId(), 2);
Assert.assertEquals(loadedA.getVal(), "val2");
Assert.assertTrue(loadedA instanceof TpcInheritA);
Assert.assertEquals(((TpcInheritA) loadedA).getInhA(), "inhA");
insertUpdateDelete(session, TpcInheritA.class, (TpcInheritA) loadedA, new UpdateCallback<TpcInheritA>() {
@Override public void modify(TpcInheritA inst) {
Assert.assertTrue(inst instanceof TpcInheritA);
}
@Override public void check(TpcInheritA inst) {
Assert.assertTrue(inst instanceof TpcInheritA);
Assert.assertEquals(inst.getVal(), "val2");
}
}, 2);
session.insert(loadedA);
TpcBaseEntity loadedB = session.loadOne(TpcInheritB.class, 3);
Assert.assertNotNull(loadedB);
Assert.assertEquals(loadedB.getId(), 3);
Assert.assertEquals(loadedB.getVal(), "val3");
Assert.assertTrue(loadedB instanceof TpcInheritB);
Assert.assertEquals(((TpcInheritB) loadedB).getInhB(), "inhB");
insertUpdateDelete(session, TpcInheritB.class, (TpcInheritB) loadedB, new UpdateCallback<TpcInheritB>() {
@Override public void modify(TpcInheritB inst) {
Assert.assertTrue(inst instanceof TpcInheritB);
}
@Override public void check(TpcInheritB inst) {
Assert.assertTrue(inst instanceof TpcInheritB);
Assert.assertEquals(inst.getVal(), "val3");
}
}, 3);
session.insert(loadedB);
TpcBaseEntity loadedB2 = session.loadOne(TpcInheritB2.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof TpcInheritB2);
Assert.assertEquals(((TpcInheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((TpcInheritB2) loadedB2).getInhB2(), "inhB2");
insertUpdateDelete(session, TpcInheritB2.class, (TpcInheritB2) loadedB2, new UpdateCallback<TpcInheritB2>() {
@Override public void modify(TpcInheritB2 inst) {
Assert.assertTrue(inst instanceof TpcInheritB2);
}
@Override public void check(TpcInheritB2 inst) {
Assert.assertTrue(inst instanceof TpcInheritB2);
Assert.assertEquals(inst.getVal(), "val4");
}
}, 4);
session.insert(loadedB2);
TpcBaseEntity loadedC = session.loadOne(TpcInheritC.class, 5);
Assert.assertNotNull(loadedC);
Assert.assertEquals(loadedC.getId(), 5);
Assert.assertEquals(loadedC.getVal(), "val5");
Assert.assertTrue(loadedC instanceof TpcInheritC);
Assert.assertEquals(((TpcInheritC) loadedC).getInhC(), "inhC");
insertUpdateDelete(session, TpcInheritC.class, (TpcInheritC) loadedC, new UpdateCallback<TpcInheritC>() {
@Override public void modify(TpcInheritC inst) {
Assert.assertTrue(inst instanceof TpcInheritC);
}
@Override public void check(TpcInheritC inst) {
Assert.assertEquals(inst.getVal(), "val5");
}
}, 5);
session.insert(loadedC);
loadedB2 = session.loadOne(TpcInheritB.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof TpcInheritB2);
Assert.assertEquals(((TpcInheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((TpcInheritB2) loadedB2).getInhB2(), "inhB2");
loadedA = session.loadOne(TpcBaseEntity.class, 2);
Assert.assertNotNull(loadedA);
Assert.assertEquals(loadedA.getId(), 2);
Assert.assertEquals(loadedA.getVal(), "val2");
Assert.assertTrue(loadedA instanceof TpcInheritA);
Assert.assertEquals(((TpcInheritA) loadedA).getInhA(), "inhA");
insertUpdateDelete(session, TpcBaseEntity.class, loadedA, new UpdateCallback<TpcBaseEntity>() {
@Override public void modify(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritA);
}
@Override public void check(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritA);
Assert.assertEquals(inst.getVal(), "val2");
}
}, 2);
loadedB = session.loadOne(TpcBaseEntity.class, 3);
Assert.assertNotNull(loadedB);
Assert.assertEquals(loadedB.getId(), 3);
Assert.assertEquals(loadedB.getVal(), "val3");
Assert.assertTrue(loadedB instanceof TpcInheritB);
Assert.assertEquals(((TpcInheritB) loadedB).getInhB(), "inhB");
insertUpdateDelete(session, TpcBaseEntity.class, loadedB, new UpdateCallback<TpcBaseEntity>() {
@Override public void modify(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritB);
}
@Override public void check(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritB);
Assert.assertEquals(inst.getVal(), "val3");
}
}, 3);
loadedB2 = session.loadOne(TpcBaseEntity.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof TpcInheritB2);
Assert.assertEquals(((TpcInheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((TpcInheritB2) loadedB2).getInhB2(), "inhB2");
insertUpdateDelete(session, TpcBaseEntity.class, loadedB2, new UpdateCallback<TpcBaseEntity>() {
@Override public void modify(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritB2);
}
@Override public void check(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritB2);
Assert.assertEquals(inst.getVal(), "val4");
}
}, 4);
loadedC = session.loadOne(TpcBaseEntity.class, 5);
Assert.assertNotNull(loadedC);
Assert.assertEquals(loadedC.getId(), 5);
Assert.assertEquals(loadedC.getVal(), "val5");
Assert.assertTrue(loadedC instanceof TpcInheritC);
Assert.assertEquals(((TpcInheritC) loadedC).getInhC(), "inhC");
insertUpdateDelete(session, TpcBaseEntity.class, loadedC, new UpdateCallback<TpcBaseEntity>() {
@Override public void modify(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritC);
}
@Override public void check(TpcBaseEntity inst) {
Assert.assertTrue(inst instanceof TpcInheritC);
Assert.assertEquals(inst.getVal(), "val5");
}
}, 5);
//
//
//
instBase = new TpcBaseEntity();
instBase.setId(1);
instBase.setCid(1);
instBase.setVal("val1");
session.insert(instBase);
instA = new TpcInheritA();
instA.setId(1);
instA.setCid(2);
instA.setVal("val2");
instA.setInhA("inhA");
session.insert(instA);
instB = new TpcInheritB();
instB.setId(1);
instB.setCid(3);