Package org.caffinitas.mapper.test.lazy.st

Examples of org.caffinitas.mapper.test.lazy.st.StInheritC


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

            StInheritC instC = new StInheritC();
            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);

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

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

            StInheritB2 loadedB2 = (StInheritB2) session.loadOne(StBaseEntity.class, 3);
            Assert.assertTrue(loadedB2.getInhB2() instanceof LazyList);
            Assert.assertEquals(loadedB2.getInhB2(), Arrays.asList("one", "two", "three"));
            loadedB2 = session.loadOne(StInheritB2.class, 3);
            Assert.assertTrue(loadedB2.getInhB2() instanceof LazyList);
            Assert.assertEquals(loadedB2.getInhB2(), Arrays.asList("one", "two", "three"));

            StInheritC loadedC = (StInheritC) session.loadOne(StBaseEntity.class, 4);
            Assert.assertTrue(loadedC.getInhC() instanceof LazyMap);
            Assert.assertEquals(loadedC.getInhC().keySet(), new HashSet<String>(Arrays.asList("one", "two", "three")));
            loadedC = session.loadOne(StInheritC.class, 4);
            Assert.assertTrue(loadedC.getInhC() instanceof LazyMap);
            Assert.assertEquals(loadedC.getInhC().keySet(), new HashSet<String>(Arrays.asList("one", "two", "three")));

        }finally {session.close();}
    }
View Full Code Here

TOP

Related Classes of org.caffinitas.mapper.test.lazy.st.StInheritC

Copyright © 2018 www.massapicom. 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.