Beispiel #1
0
  @Test
  public void testUpdate() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZhunzaiDAO zhunzaiDao = (ZhunzaiDAO) ctx.getBean("zhunzaiDao");

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

    zhunzaiDao.update(z);
  }
Beispiel #2
0
  @Test
  public void testInsert() throws Exception {

    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    ZhunzaiDAO zhunzaiDao = (ZhunzaiDAO) ctx.getBean("zhunzaiDao");

    Zhunzai z = new Zhunzai();

    Yuangong yg = new Yuangong();
    yg.setId(2);
    z.setFz_person(yg);
    z.setZhunzai_time("2011-9-8");

    zhunzaiDao.insert(z);

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