Package test.po

Examples of test.po.Pet


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

    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


    String err = EWeb4JConfig.start("start.eweb.xml");
    if (err != null){
      System.out.println(">>>EWeb4J Start Error --> " + err);
      System.exit(-1);
    }
    pet = new Pet();
    pet.setAge(30);
    delete = SqlFactory.getDeleteSql(pet);
  }
View Full Code Here

 
  public void save(){
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("JPAPU");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Pet pet = new Pet();
    pet.setNumber("weejkl");
    pet.setAge(2);
    pet.setName("非常小");
    pet.setType("dog");
    em.persist(pet);
    em.getTransaction().commit();
    emf.close();
  }
View Full Code Here

  public void testMap() {
    Transaction.execute(new Trans() {

      @Override
      public void run(Object... args) throws Exception {
        Pet pet = Pet.inst.find().first();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("table", "t_pet");
        map.put("idColumn", "id");
        map.put("idValue", pet.getId());
        map.put("columns",
            new String[] { "num", "name", "age", "cate" });
        map.put("values", new Object[] { 123, "weiwei", 3, "dog" });
        DAOFactory.getUpdateDAO().update(map);
        DAOFactory.getInsertDAO().insert(map);
View Full Code Here

    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

    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

    try {
      masterList = DAOFactory.getSelectDAO().selectAll(Master.class);
      if (masterList != null) {
        for (Master m : masterList) {
          System.out.println(m + "|" + m.getPets());
          Pet p = new Pet();
          p.setPetId(5L);
          m.getPets().add(p);
          DAOFactory.getCascadeDAO().delete(m, "pets");
          break;
        }
      }
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

    String err = EWeb4JConfig.start("start.eweb.xml");
    if (err != null) {
      System.out.println(">>>EWeb4J Start Error --> " + err);
      System.exit(-1);
    }
    pet = new Pet();
    update = SqlFactory.getUpdateSql(pet);
  }
View Full Code Here

    map.put("table", "t_pet");
    map.put("idColumn", "id");
    map.put("idValue", 5);
    map.put("columns", new String[] { "num", "name", "age", "type" });
    map.put("values", new Object[] { 123, "weiwei", 3, "dog" });
    Pet pet = new Pet();
    pet.setName("xxx");
    pet.setNumber("4444");
    pet.setAge(3);
    pet.setType("cat");
    UpdateSqlCreator<?> update = SqlFactory.getUpdateSql(map, pet);

    Assert.assertEquals(
        "UPDATE t_pet SET num = '123',name = 'weiwei',age = '3',type = 'dog' WHERE id = '5' ;",
        update.update()[0]);
View Full Code Here

TOP

Related Classes of test.po.Pet

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.