Examples of TpcInheritB


Examples of org.caffinitas.mapper.test.lazy.tpc.TpcInheritB

            TpcInheritA instA = new TpcInheritA();
            instA.setId(1);
            instA.setInhA(Arrays.asList("one", "two", "three"));
            session.insert(instA);

            TpcInheritB instB = new TpcInheritB();
            instB.setId(2);
            instB.setInhB(new HashSet<String>(Arrays.asList("one", "two", "three")));
            session.insert(instB);

            TpcInheritB2 instB2 = new TpcInheritB2();
            instB2.setId(3);
            instB2.setInhB2(Arrays.asList("one", "two", "three"));
            session.insert(instB2);

            TpcInheritC instC = new TpcInheritC();
            instC.setId(4);
            instC.setInhC(new HashMap<String, String>());
            instC.getInhC().put("one", "1");
            instC.getInhC().put("two", "2");
            instC.getInhC().put("three", "3");
            session.insert(instC);

            TpcInheritA loadedA = (TpcInheritA) session.loadOne(TpcBaseEntity.class, 1);
            Assert.assertTrue(loadedA.getInhA() instanceof LazyList);
            Assert.assertEquals(loadedA.getInhA(), Arrays.asList("one", "two", "three"));
            loadedA = session.loadOne(TpcInheritA.class, 1);
            Assert.assertTrue(loadedA.getInhA() instanceof LazyList);
            Assert.assertEquals(loadedA.getInhA(), Arrays.asList("one", "two", "three"));

            TpcInheritB loadedB = (TpcInheritB) session.loadOne(TpcBaseEntity.class, 2);
            Assert.assertTrue(loadedB.getInhB() instanceof LazySet);
            Assert.assertEquals(loadedB.getInhB(), new HashSet<String>(Arrays.asList("one", "two", "three")));
            loadedB = session.loadOne(TpcInheritB.class, 2);
            Assert.assertTrue(loadedB.getInhB() instanceof LazySet);
            Assert.assertEquals(loadedB.getInhB(), new HashSet<String>(Arrays.asList("one", "two", "three")));

            TpcInheritB2 loadedB2 = (TpcInheritB2) session.loadOne(TpcBaseEntity.class, 3);
            Assert.assertTrue(loadedB2.getInhB2() instanceof LazyList);
            Assert.assertEquals(loadedB2.getInhB2(), Arrays.asList("one", "two", "three"));
            loadedB2 = session.loadOne(TpcInheritB2.class, 3);
View Full Code Here

Examples of org.caffinitas.mapper.test.model.inherit.tpc.TpcInheritB

            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);
            instB.setVal("val3");
            instB.setInhB("inhB");
            session.insert(instB);

            instB2 = new TpcInheritB2();
            instB2.setId(1);
            instB2.setCid(4);
View Full Code Here

Examples of org.caffinitas.mapper.test.query.tpc.TpcInheritB

            session.insert(inst);
            inst = new TpcInheritA();
            inst.setId(32);
            inst.setVal("two");
            session.insert(inst);
            inst = new TpcInheritB();
            inst.setId(33);
            inst.setVal("three");
            session.insert(inst);
            inst = new TpcInheritB2();
            inst.setId(34);
View Full Code Here

Examples of org.caffinitas.mapper.test.query.tpc.TpcInheritB

            Assert.assertNotNull(result);
            Assert.assertTrue(result.isEmpty());

            // insert data

            TpcInheritB inst = new TpcInheritB();
            inst.setId(21);
            inst.setVal("one");
            session.insert(inst);
            inst.setId(22);
            inst.setVal("two");
            session.insert(inst);
            inst.setId(23);
            inst.setVal("three");
            session.insert(inst);

            // again

            queryBinder = session.createQueryBinder(TpcInheritB.class, null, "id in :id", null);
View Full Code Here

Examples of org.caffinitas.mapper.test.query.tpc.TpcInheritB

            session.insert(inst);
            inst = new TpcInheritA();
            inst.setId(42);
            inst.setVal("two");
            session.insert(inst);
            inst = new TpcInheritB();
            inst.setId(43);
            inst.setVal("three");
            session.insert(inst);
            inst = new TpcInheritB2();
            inst.setId(44);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.