Пример #1
0
  @Test
  public void testUpdate() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZaiqianDAO zaiqianDao = (ZaiqianDAO) ctx.getBean("zaiqianDao");

    Zaiqian z = new Zaiqian();

    z.setId(1);
    Yuangong yg = new Yuangong();
    yg.setId(2);
    z.setFz_person(yg);

    zaiqianDao.update(z);
  }
Пример #2
0
  @Test
  public void testInsert() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZaiqianDAO zaiqianDao = (ZaiqianDAO) ctx.getBean("zaiqianDao");

    Zaiqian z = new Zaiqian();

    Yuangong yg = new Yuangong();
    yg.setId(2);
    z.setFz_person(yg);
    z.setChandizm_id("asdasdasd");
    z.setYunshuzm_id("detttttt");
    z.setZaiqian_time("2000-1-1");

    zaiqianDao.insert(z);

    // All need is to create an instance with primary key
  }