Package org.nutz.dao.test.meta

Examples of org.nutz.dao.test.meta.Master


  @Test
  public void insert_links() {
    dao.create(Pet.class, true);
    dao.create(Master.class, true);

    Master m = new Master();
    m.setName("zozoh");
    m.setPets(new ArrayList<Pet>(2));

    Pet pet = new Pet();
    pet.setAge(25);
    pet.setName("Wendal");
    m.getPets().add(pet);

    pet = new Pet();
    pet.setAge(25);
    pet.setName("Juqkai");
    m.getPets().add(pet);

    dao.insertWith(m, "pets");
    assertTrue(m.getId() > 0);
    assertEquals(2, dao.count(Pet.class, Cnd.where("masterId", "=", m.getId())));
  }
View Full Code Here


   
    // issue 395 删除一个不存在的管理对象
    @Test
    public void test_delete_null_many() {
       dao.create(Master.class, true);
         Master master = new Master();
         master.setName("ACB");
         dao.insert(master);
         master = dao.fetch(Master.class);
         dao.fetchLinks(master, null);
         dao.deleteWith(master, null);
    }
View Full Code Here

    @Test
    public void insert_links() {
        dao.create(Pet.class, true);
        dao.create(Master.class, true);

        Master m = new Master();
        m.setName("zozoh");
        m.setPets(new ArrayList<Pet>(2));

        Pet pet = new Pet();
        pet.setAge(25);
        pet.setName("Wendal");
        m.getPets().add(pet);

        pet = new Pet();
        pet.setAge(25);
        pet.setName("Juqkai");
        m.getPets().add(pet);

        dao.insertWith(m, "pets");
        assertTrue(m.getId() > 0);
        assertEquals(2, dao.count(Pet.class, Cnd.where("masterId", "=", m.getId())));
    }
View Full Code Here

    // issue 395 删除一个不存在的管理对象
    @Test
    public void test_delete_null_many() {
        dao.create(Master.class, true);
        Master master = new Master();
        master.setName("ACB");
        dao.insert(master);
        master = dao.fetch(Master.class);
        dao.fetchLinks(master, null);
        dao.deleteWith(master, null);
    }
View Full Code Here

TOP

Related Classes of org.nutz.dao.test.meta.Master

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.