@Test public void testInsertAndGetId() { @SuppressWarnings("resource") AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"config/applicationContext.xml"}); AdminDao userdao = (AdminDao) ctx.getBean("AdminDao"); Admin user = new Admin(); user.setAdminName("'why'"); user.setAdminId("123"); System.out.println(userdao.insertAndGetId(user)); }
@Test public void testSaveAdmin() { @SuppressWarnings("resource") AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"config/applicationContext.xml"}); AdminDao userdao = (AdminDao) ctx.getBean("AdminDao"); Admin user = new Admin(); user.setAdminName("'why'"); user.setAdminId("123"); userdao.save(user); }