Examples of Pet


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

    map.put("id", "userId");
    map.put("name", "userName");
    map.put("alias", "alias");
    map.put("age", "age");
   
    Pet pet = new Pet();
    pet.setId(18);
    pet.setName("pet");
    pet.setNickName("haha");
    pet.setAge(5);
   
    sql.vars().putAll(map);
    sql.params().putAll(pet);

    String expect = "INSERT INTO t_pet(userId,userName,alias,age) VALUES(18,'pet','haha',5)";
View Full Code Here

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

      public String[] supportedTypes() {
        return Lang.array("cc");
      }
    });

    Pet pet = ioc.get(Pet.class, "xb");
    assertEquals("CC:XiaoBai", pet.getName());
  }
View Full Code Here

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

    assertEquals("pet6", pets.get(0).getName());
  }

  @Test
  public void fetch_by_name() {
    Pet pet = dao.fetch(Pet.class, Cnd.where("name", "=", "pet2"));
    assertEquals("pet2", pet.getName());
  }
View Full Code Here

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

  }

  @Test
  public void fetch_record() {
    Record re = dao.fetch("t_pet", Cnd.where("name", "=", "pet3"));
    Pet pet = re.toPojo(Pet.class);
    assertEquals(5, re.getColumnCount());
    assertEquals(4, pet.getId());
    assertEquals("pet3", pet.getName());
  }
View Full Code Here

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

  protected void after() {}

  @Test
  public void test_update_chain_and_cnd_by_in() {
    dao.create(Pet.class, true);
    Pet pet = Pet.create("xb");
    pet.setNickName("XB");
    dao.insert(pet);

    dao.updatePet.class,
          Chain.make("name", "xiaobai"),
          Cnd.where("nickName", "in", Lang.array("XB")));
    pet = dao.fetch(Pet.class, "xiaobai");
    assertEquals("XB", pet.getNickName());
  }
View Full Code Here

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

  }

  @Test
  public void test_update_chain_and_cnd() {
    dao.create(Pet.class, true);
    Pet pet = Pet.create("xb");
    pet.setNickName("XB");
    dao.insert(pet);

    dao.update(Pet.class, Chain.make("name", "xiaobai"), Cnd.where("nickName", "=", "XB"));
    pet = dao.fetch(Pet.class, "xiaobai");
    assertEquals("XB", pet.getNickName());
  }
View Full Code Here

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

    dao.create(Pet.class, true);
  }

  private void insertRecords(int len) {
    for (int i = 0; i < len; i++) {
      Pet pet = Pet.create("pet" + i);
      pet.setNickName("alias_" + i);
      dao.insert(pet);
    }
  }
View Full Code Here

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

  }

  @Test
  public void test_simple_update() {
    dao.fastInsert(Lang.array(Pet.create("A"), Pet.create("B")));
    Pet a = dao.fetch(Pet.class, "A");
    a.setName("C");
    a.setAge(5);

    dao.update(a);

    Pet c = dao.fetch(Pet.class, "C");
    assertEquals("C", c.getName());
    assertEquals(5, c.getAge());

    Pet b = dao.fetch(Pet.class, "B");
    assertEquals("B", b.getName());
    assertEquals(0, b.getAge());
  }
View Full Code Here

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

  }

  @Test
  public void test_fetch_by_condition_in_special_char() {
    dao.insert(Pet.create("a@b").setNickName("ABC"));
    Pet pet = dao.fetch(Pet.class, Cnd.where("name", "=", "a@b"));
    assertEquals("a@b", pet.getName());
    assertEquals("ABC", pet.getNickName());
  }
View Full Code Here

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

    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
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.