Package jodd.db.oom.tst

Examples of jodd.db.oom.tst.Girl2


    session.closeSession();


    session = new DbThreadSession(cp);
    DbOomManager.getInstance().registerEntity(Girl2.class, true);
    Girl2 g2 = new Girl2("Gwen");
    q = DbEntitySql.insert(g2).query();
    assertEquals("insert into GIRL (NAME) values (:girl2.name)", q.getQueryString());
    q.setGeneratedColumns("ID");
    q.executeUpdate();
    DbOomUtil.populateGeneratedKeys(g2, q);
View Full Code Here


    dbOom.registerEntity(Girl2.class);
    dbOom.registerEntity(Boy.class);

    dbSession = new DbThreadSession(cp);

    assertEquals(1, DbEntitySql.insert(new Girl2(1, "Anna", "swim")).query().executeUpdate());
    assertEquals(1, DbEntitySql.insert(new Girl2(2, "Sandra", "piano")).query().executeUpdate());
    assertEquals(1, DbEntitySql.insert(new Girl2(3, "Emma", "nothing")).query().executeUpdate());
    assertEquals(1, DbEntitySql.insert(new Boy(1, "Johny", 2)).query().executeUpdate());
    assertEquals(1, DbEntitySql.insert(new Boy(2, "Marco", 2)).query().executeUpdate());
    assertEquals(1, DbEntitySql.insert(new Boy(3, "Hugo", 1)).query().executeUpdate());
  }
View Full Code Here

    List<Object[]> result = q.cacheEntities(true).list(Girl2.class, Boy.class);

    assertEquals(3, result.size());

    Girl2 girl1 = (Girl2) result.get(0)[0];
    Girl2 girl2 = (Girl2) result.get(1)[0];
    Girl2 girl3 = (Girl2) result.get(2)[0];

    assertTrue(girl1.equals(girl2));
    assertTrue(girl1 == girl2);
    assertFalse(girl3 == girl1);

    Boy boy1 = (Boy) result.get(0)[1];
    Boy boy2 = (Boy) result.get(1)[1];
    Boy boy3 = (Boy) result.get(2)[1];

    assertTrue(boy1.id != boy2.id);
    assertFalse(boy1 == boy2);
    assertFalse(boy2 == boy3);

    assertNull(girl1.getBoys());
    assertNull(girl3.getBoys());
  }
View Full Code Here

    List<Object[]> result = q.cacheEntities(true).list(Girl2.class, Boy.class);

    assertEquals(4, result.size());

    Girl2 girl0 = (Girl2) result.get(0)[0];
    Girl2 girl1 = (Girl2) result.get(1)[0];
    Girl2 girl2 = (Girl2) result.get(2)[0];
    Girl2 girl3 = (Girl2) result.get(3)[0];

    assertEquals("Emma", girl0.name);
    assertTrue(girl1.equals(girl2));
    assertTrue(girl1 == girl2);
    assertFalse(girl3 == girl1);

    Boy boy0 = (Boy) result.get(0)[1];
    Boy boy1 = (Boy) result.get(1)[1];
    Boy boy2 = (Boy) result.get(2)[1];
    Boy boy3 = (Boy) result.get(3)[1];

    assertNull(boy0);
    assertTrue(boy1.id != boy2.id);
    assertFalse(boy1 == boy2);
    assertFalse(boy2 == boy3);

    assertNull(girl1.getBoys());
    assertNull(girl3.getBoys());
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").cacheEntities(true).list(Girl2.class, Boy.class);

    assertEquals(3, result2.size());

    Girl2 girl1 = result2.get(0);
    Girl2 girl2 = result2.get(1);
    Girl2 girl3 = result2.get(2);

    assertTrue(girl1.equals(girl2));
    assertTrue(girl1 == girl2);
    assertFalse(girl3 == girl1);

    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());

    assertNotNull(girl3.getBoys());
    assertEquals(1, girl3.getBoys().size());
    assertEquals("Hugo", girl3.getBoys().get(0).name);
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").cacheEntities(true).list(Girl2.class, Boy.class);

    assertEquals(4, result2.size());

    Girl2 girl0 = result2.get(0);
    Girl2 girl1 = result2.get(1);
    Girl2 girl2 = result2.get(2);
    Girl2 girl3 = result2.get(3);

    assertTrue(girl1.equals(girl2));
    assertTrue(girl1 == girl2);
    assertFalse(girl3 == girl1);

    assertNull(girl0.getBoys());
    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());

    assertNotNull(girl3.getBoys());
    assertEquals(1, girl3.getBoys().size());
    assertEquals("Hugo", girl3.getBoys().get(0).name);
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").entityAwareMode(true).list(Girl2.class, Boy.class);

    assertEquals(2, result2.size());

    Girl2 girl1 = result2.get(0);
    Girl2 girl3 = result2.get(1);

    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());

    assertNotNull(girl3.getBoys());
    assertEquals(1, girl3.getBoys().size());
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").entityAwareMode(true).list(Girl2.class, Boy.class);

    assertEquals(3, result2.size());

    Girl2 girl0 = result2.get(0);
    Girl2 girl1 = result2.get(1);
    Girl2 girl3 = result2.get(2);

    assertNull(girl0.getBoys());

    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());

    assertNotNull(girl3.getBoys());
    assertEquals(1, girl3.getBoys().size());
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").entityAwareMode(true).list(1, Girl2.class, Boy.class);

    assertEquals(1, result2.size());

    Girl2 girl1 = result2.get(0);

    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());
  }
View Full Code Here

    List<Girl2> result2 = q.withHints("g", "g.boys").entityAwareMode(true).list(2, Girl2.class, Boy.class);

    assertEquals(2, result2.size());

    Girl2 girl0 = result2.get(0);
    Girl2 girl1 = result2.get(1);

    assertNull(girl0.getBoys());
    assertNotNull(girl1.getBoys());
    assertEquals(2, girl1.getBoys().size());
  }
View Full Code Here

TOP

Related Classes of jodd.db.oom.tst.Girl2

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.