Package test.po

Examples of test.po.Master


   *
   * @throws Exception
   */
  @Test
  public void testDeleteByOneRelField() throws Exception {
    Master master = new Master();
    master.setId(5);
    pet.setMaster(master);
    String[] fields = { "master" };
    String sql = delete.delete(fields)[0];
    Assert.assertEquals("DELETE FROM t_pet WHERE master_id = '5' ;", sql);
  }
View Full Code Here


  public static void testOneUpdate() {
    Transaction.execute(new Trans() {
     
      @Override
      public void run(Object... args) throws Exception {
        Master master = new Master();
        master.setId(1L);
        DAOFactory.getCascadeDAO().update(master, "pets", 2);
        //throw new Exception();
      }
     
    });
View Full Code Here

    });
   
  }

  public static void testManyInsert() {
    Master master = new Master();
    master.setName("小日主人1");
    master.setGender("boy");
    long id = (Integer) DAOFactory.getInsertDAO().insert(master);
    master.setId(id);
    Pet pet = new Pet();
    pet.setName("小日1");
    pet.setType("dog");
    master.getPets().add(pet);

    pet = new Pet();
    pet.setName("小日2");
    pet.setType("cat");
    master.getPets().add(pet);

    DAOFactory.getCascadeDAO().insert(master);
  }
View Full Code Here

    //
    // pet.getMasters().add(master);
    // boolean flag = DAOFactory.getCascadeDAO().insert(pet);
    // System.out.println(flag);

    Master master = new Master();
    // master.setId(36);
    master.setName("日本人");
    master.setGender("boy");
    Pet pet = new Pet();
    pet.setName("小日1");
    pet.setType("dog");
    pet.setPetId(6490L);
    master.getPets().add(pet);

    pet = new Pet();
    pet.setName("小日2");
    pet.setType("cat");
    master.getPets().add(pet);

    DAOFactory.getCascadeDAO().insert(master);
  }
View Full Code Here

  /**
   * 测试多对多更新
   */
  public static void testManyManyUpdate() {
    Master master = new Master().find().first();
    master.cascade().refresh(999, "pets");
  }
View Full Code Here

    // TestCascadeDAO.testManyDelete();
    // TestCascadeDAO.testManyManyInsert();
    // TestCascadeDAO.testManyManySelect();
    // TestCascadeDAO.testManyManyDelete();
    // TestCascadeDAO.testManyManyUpdate();
    Master master = new Master().findById(1012);
    System.out.println("=============== " + master);
    //master.cascade().merge("pets");
    System.out.println("===after=="+master);
   
    master.cascade().refresh(6, "pets");
   
    //master.setId(1001);
    //master.cascade().persist("pets");
//    Pet pet = new Pet().find().first();
//    pet.setId(0L);
View Full Code Here

    }
  }

  @Test
  public void testOneRel() throws Exception {
    Master master = new Master();
    master.setId(1L);

    master.getPets().add(new Pet());
    master.getPets().add(new Pet());
    master.getPets().add(new Pet());

    //DAOFactory.getCascadeDAO().insert(master, "pets");
    Assert.assertEquals(true, true);
  }
View Full Code Here

  public void testUpdate() {
    pet.setPetId(5L);
    pet.setName("小黑");
    pet.setType("dog");
    pet.setAge(1111);
    Master master = new Master();
    master.setId(9L);
    pet.setMaster(master);
    String sql = update.update()[0];
    Assert.assertEquals(
        "UPDATE t_pet SET name = '小黑',age = '1111',cate = 'dog',master_id = '9' WHERE id = '5' ;",sql);
  }
View Full Code Here

  @Test
  public <T> void testUpdateByField() {
    pet.setName("xiaohuang");
    pet.setAge(3);
    pet.setPetId(12L);
    Master master = new Master();
    master.setId(5L);
    pet.setMaster(master);
    String[] fields = { "name", "age", "master" };
    String sql = update.update(fields)[0];
    Assert.assertEquals(
        "UPDATE t_pet SET name = 'xiaohuang', age = '3', master_id = '5' WHERE id = '12' ;",
View Full Code Here

    if (err != null) {
      System.out.println(">>>EWeb4J Start Error --> " + err);
      System.exit(-1);
    }
    pet = new Pet();
    master = new Master();
    master.setId(5L);
    pet.setMaster(master);
    pet.setName("xiaobai");
    select = SqlFactory.getSelectSql(pet, "mysql");
    fieldAdd = "+0";
View Full Code Here

TOP

Related Classes of test.po.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.