waitEntityAvailable(entityC);
PersistenceSession session = persistenceManager.createSession();
try {
Tpc2InheritA instA = new Tpc2InheritA();
instA.setId(2);
instA.setCid(1);
instA.setVal("val2");
instA.setInhA("inhA");
session.insert(instA);
Tpc2InheritB2 instB2 = new Tpc2InheritB2();
instB2.setId(4);
instB2.setCid(1);
instB2.setVal("val4");
instB2.setInhB("inhB");
instB2.setInhB2("inhB2");
session.insert(instB2);
Tpc2InheritB3 instB3 = new Tpc2InheritB3();
instB3.setId(6);
instB3.setCid(1);
instB3.setVal("val4");
instB3.setInhB("inhB");
instB3.setInhB2("inhB2");
session.insert(instB2);
Tpc2InheritC instC = new Tpc2InheritC();
instC.setId(5);
instC.setCid(1);
instC.setVal("val5");
instC.setInhC("inhC");
session.insert(instC);
Tpc2BaseEntity loadedA = session.loadOne(Tpc2InheritA.class, 2);
Assert.assertNotNull(loadedA);
Assert.assertEquals(loadedA.getId(), 2);
Assert.assertEquals(loadedA.getVal(), "val2");
Assert.assertTrue(loadedA instanceof Tpc2InheritA);
Assert.assertEquals(((Tpc2InheritA) loadedA).getInhA(), "inhA");
insertUpdateDelete(session, Tpc2InheritA.class, (Tpc2InheritA) loadedA, new UpdateCallback<Tpc2InheritA>() {
@Override public void modify(Tpc2InheritA inst) {
Assert.assertTrue(inst instanceof Tpc2InheritA);
}
@Override public void check(Tpc2InheritA inst) {
Assert.assertTrue(inst instanceof Tpc2InheritA);
Assert.assertEquals(inst.getVal(), "val2");
}
}, 2);
session.insert(loadedA);
Tpc2BaseEntity loadedB2 = session.loadOne(Tpc2InheritB2.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof Tpc2InheritB2);
Assert.assertEquals(((Tpc2InheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((Tpc2InheritB2) loadedB2).getInhB2(), "inhB2");
insertUpdateDelete(session, Tpc2InheritB2.class, (Tpc2InheritB2) loadedB2, new UpdateCallback<Tpc2InheritB2>() {
@Override public void modify(Tpc2InheritB2 inst) {
Assert.assertTrue(inst instanceof Tpc2InheritB2);
}
@Override public void check(Tpc2InheritB2 inst) {
Assert.assertTrue(inst instanceof Tpc2InheritB2);
Assert.assertEquals(inst.getVal(), "val4");
}
}, 4);
session.insert(loadedB2);
Tpc2BaseEntity loadedC = session.loadOne(Tpc2InheritC.class, 5);
Assert.assertNotNull(loadedC);
Assert.assertEquals(loadedC.getId(), 5);
Assert.assertEquals(loadedC.getVal(), "val5");
Assert.assertTrue(loadedC instanceof Tpc2InheritC);
Assert.assertEquals(((Tpc2InheritC) loadedC).getInhC(), "inhC");
insertUpdateDelete(session, Tpc2InheritC.class, (Tpc2InheritC) loadedC, new UpdateCallback<Tpc2InheritC>() {
@Override public void modify(Tpc2InheritC inst) {
//inst.setStr("422");
}
@Override public void check(Tpc2InheritC inst) {
Assert.assertEquals(inst.getVal(), "val5");
}
}, 5);
session.insert(loadedC);
loadedB2 = session.loadOne(Tpc2InheritB.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof Tpc2InheritB2);
Assert.assertEquals(((Tpc2InheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((Tpc2InheritB2) loadedB2).getInhB2(), "inhB2");
loadedA = session.loadOne(Tpc2BaseEntity.class, 2);
Assert.assertNotNull(loadedA);
Assert.assertEquals(loadedA.getId(), 2);
Assert.assertEquals(loadedA.getVal(), "val2");
Assert.assertTrue(loadedA instanceof Tpc2InheritA);
Assert.assertEquals(((Tpc2InheritA) loadedA).getInhA(), "inhA");
insertUpdateDelete(session, Tpc2BaseEntity.class, loadedA, new UpdateCallback<Tpc2BaseEntity>() {
@Override public void modify(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritA);
}
@Override public void check(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritA);
Assert.assertEquals(inst.getVal(), "val2");
}
}, 2);
loadedB2 = session.loadOne(Tpc2BaseEntity.class, 4);
Assert.assertNotNull(loadedB2);
Assert.assertEquals(loadedB2.getId(), 4);
Assert.assertEquals(loadedB2.getVal(), "val4");
Assert.assertTrue(loadedB2 instanceof Tpc2InheritB2);
Assert.assertEquals(((Tpc2InheritB) loadedB2).getInhB(), "inhB");
Assert.assertEquals(((Tpc2InheritB2) loadedB2).getInhB2(), "inhB2");
insertUpdateDelete(session, Tpc2BaseEntity.class, loadedB2, new UpdateCallback<Tpc2BaseEntity>() {
@Override public void modify(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritB2);
}
@Override public void check(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritB2);
Assert.assertEquals(inst.getVal(), "val4");
}
}, 4);
loadedC = session.loadOne(Tpc2BaseEntity.class, 5);
Assert.assertNotNull(loadedC);
Assert.assertEquals(loadedC.getId(), 5);
Assert.assertEquals(loadedC.getVal(), "val5");
Assert.assertTrue(loadedC instanceof Tpc2InheritC);
Assert.assertEquals(((Tpc2InheritC) loadedC).getInhC(), "inhC");
insertUpdateDelete(session, Tpc2BaseEntity.class, loadedC, new UpdateCallback<Tpc2BaseEntity>() {
@Override public void modify(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritC);
}
@Override public void check(Tpc2BaseEntity inst) {
Assert.assertTrue(inst instanceof Tpc2InheritC);
Assert.assertEquals(inst.getVal(), "val5");
}
}, 5);
//
//
//
instA = new Tpc2InheritA();
instA.setId(1);
instA.setCid(2);
instA.setVal("val2");
instA.setInhA("inhA");
session.insert(instA);
instB2 = new Tpc2InheritB2();
instB2.setId(1);
instB2.setCid(4);