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