Package org.nutz.dao.entity

Examples of org.nutz.dao.entity.Record


    assertEquals("pet5", pets.get(1).get("name"));
  }

  @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


    }

    @Test
    @SuppressWarnings("unchecked")
    public void receiveJsonRequest4Record() {
        Record record = new Record();
        record.put("a", "a");
        record.put("b", 1);

        JsonRequest<Record> request = new JsonRequest<Record>();
        request.setBody(record);
        request.setLoginName("user1");
        request.setPassword("1234");
        request.setVersion("1101");
        request.setUserType(JsonRequest.USER_TYPE_EMPLOYEE);
        String json = Json.toJson(request);
        System.out.println(json);

        request = (JsonRequest<Record>) Json.fromJson(new NutType(request.getClass(),
                                                                  record.getClass()),
                                                      json);
        System.out.println(request.getBody().getString("a"));
        System.out.println(request.getBody().getInt("b"));
    }
View Full Code Here

        assertEquals("pet5", pets.get(1).get("name"));
    }

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

        vars.put("table", "t_pet");

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", pet.getId());

        Record re = sqlTemplate.queryForRecord(sql, vars, params);

        assertEquals(pet.getName(), re.getString("name"));
    }
View Full Code Here

        assertEquals("pet5", pets.get(1).get("name"));
    }

    @Test
    public void fetch_record() {
        Record re = dao.fetch("t_pet", Cnd.where("name", "=", "pet3"));
        if (dao.meta().isOracle())
          re.remove("rn");
        Pet pet = re.toPojo(Pet.class);
        assertEquals(7, re.getColumnCount());
        assertEquals(4, pet.getId());
        assertEquals("pet3", pet.getName());
        dao.create(Pet.class, true);
        dao.insert(Pet.create("中文啊中文"));
    }
View Full Code Here

    }

    @Test
    @SuppressWarnings("unchecked")
    public void receiveJsonRequest4Record() {
        Record record = new Record();
        record.put("a", "a");
        record.put("b", 1);

        JsonRequest<Record> request = new JsonRequest<Record>();
        request.setBody(record);
        request.setLoginName("user1");
        request.setPassword("1234");
        request.setVersion("1101");
        request.setUserType(JsonRequest.USER_TYPE_EMPLOYEE);
        String json = Json.toJson(request);
        // System.out.println(json);

        request = (JsonRequest<Record>) Json.fromJson(new NutType(request.getClass(),
                                                                  record.getClass()),
                                                      json);
        // System.out.println(request.getBody().getString("a"));
        // System.out.println(request.getBody().getInt("b"));
    }
View Full Code Here

TOP

Related Classes of org.nutz.dao.entity.Record

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.